forked from the-isf-academy/g9cs_student_setup
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_script.sh
More file actions
135 lines (122 loc) · 4.41 KB
/
setup_script.sh
File metadata and controls
135 lines (122 loc) · 4.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
YELLOW='\033[1;33m'
PURPLE='\033[1;35m'
NC='\033[0m'
# file system creation
printf "${BLUE}Creating file system...${NC}\n" sudo chown -R $(whoami) /usr/local/etc
cd /Users/`whoami`/Desktop
mkdir -p sea
cd sea
mkdir -p t1
printf "${GREEN}✓✓✓ File system created!${NC}\n\n\n"
#changing ownership of /usr/local/etc directories
sudo chown -R $(whoami) /usr/local/etc
#giving user write permission
chmod u+w /usr/local/etc
printf "${BLUE}Installing Xcode...${NC}\n"
xcode-select --install
xcode_version=$( xcode-select --version )
if [[ "$xcode_version" =~ "xcode-select version "[2-9][0-9][0-9][0-9]"." ]]; then
printf "${GREEN}✓✓✓ Xcode installed!${NC}\n\n\n"
else
printf "${RED}Message from version request: %s${NC}\n" "$xcode_version"
printf "${RED}Unexpected output from Xcode installation. Please ask an instructor for help. ${NC}"
read -p "Proceed? [y/n]: " ans
if [[ $ans == 'n' ]]; then
exit 1
fi
fi
# macOS version check, Homebrew requires 10.12 or higher
printf "${BLUE}Checking macOS version...${NC}\n"
os_version=$( defaults read loginwindow SystemVersionStampAsString )
printf "You are running macOS verion %s.\n" $os_version
if [[ "$os_version" =~ 10\.1[2-9]\.[0-9]? ]]; then
printf "${GREEN}✓✓✓ macOS version supported by Homebrew!${NC}\n\n\n"
else
printf "${RED}Installing Homebrew requires macOS version 10.12 or higher. Please ask an instructor for help. ${NC}"
read -p "Proceed? [y/n]: " ans
if [[ $ans == 'n' ]]; then
exit 1
fi
fi
# Homebrew installation
printf "${BLUE}Installing Homebrew...${NC}\n"
brew_version=$( brew --version )
if [[ "$brew_version" =~ "Homebrew "2\.[1-9]\.[1-9][0-9]?.? ]]; then
printf "${GREEN}✓✓✓ Homebrew already installed !${NC}\n\n\n"
else
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew_version=$( brew --version )
if [[ "$brew_version" =~ "Homebrew "2\.[1-9]\.[1-9][0-9]?.? ]]; then
printf "${GREEN}✓✓✓ Homebrew installed !${NC}\n\n\n"
else
printf "${RED}Output from version request: %s${NC}\n" "$brew_version"
printf "${RED}Unexpected output from Homebrew installation. Please ask an instructor for help. ${NC}"
read -p "Proceed? [y/n]: " ans
if [[ $ans == 'n' ]]; then
exit 1
fi
fi
fi
# node installation
printf "${BLUE}Installing node.js...${NC}\n"
node_version=$( node --version )
if [[ "$node_version" =~ "Node "12\.[0-9]\.[0-9]? ]]; then
printf "${GREEN}✓✓✓ Node already installed!${NC}\n\n\n"
else
brew install node
node_version=$( node --version )
if [[ "$node" =~ "Node "12\.[0-9]\.[0-9]? ]]; then
printf "${GREEN}✓✓✓ Node installed!${NC}\n\n\n"
else
printf "${RED}Output from version request: %s${NC}\n" "$node_version"
printf "${RED}Unexpected output from Node installation. Please ask an instructor for help. ${NC}"
read -p "Proceed? [y/n]: " ans
if [[ $ans == 'n' ]]; then
exit 1
fi
fi
fi
# git installation
printf "${BLUE}Installing git...${NC}\n"
git_version=$( git --version )
if [[ "$git_version" =~ "git version "2\.[2-9][0-9]?\.[0-9]? ]]; then
printf "${GREEN}✓✓✓ git already installed!${NC}\n\n\n"
else
brew install git
git_version=$( git --version )
if [[ "$git_version" =~ "git version "2\.[2-9][0-9]?\.[0-9]? ]]; then
printf "${GREEN}✓✓✓ git installed!${NC}\n\n\n"
else
printf "${RED}Output from version request: %s${NC}\n" "$git_version"
printf "${RED}Unexpected output from git installation. Please ask an instructor for help. ${NC}"
read -p "Proceed? [y/n]: " ans
if [[ $ans == 'n' ]]; then
exit 1
fi
fi
fi
# yarn installation
printf "${BLUE}Installing yarn...${NC}\n"
yarn_version=$( yarn --version )
if [[ "$yarn_version" =~ "yarn version "2\.[2-9][0-9]?\.[0-9]? ]]; then
printf "${GREEN}✓✓✓ yarn already installed!${NC}\n\n\n"
else
brew install yarn
yarn_version=$( yarn --version )
if [[ "$yarn_version" =~ "yarn version "2\.[2-9][0-9]?\.[0-9]? ]]; then
printf "${GREEN}✓✓✓ yarn installed!${NC}\n\n\n"
else
printf "${RED}Output from version request: %s${NC}\n" "$yarn_version"
printf "${RED}Unexpected output from yarn installation. Please ask an instructor for help. ${NC}"
read -p "Proceed? [y/n]: " ans
if [[ $ans == 'n' ]]; then
exit 1
fi
fi
fi
printf "${PURPLE}Your computer is configured! Please restart Terminal. ${NC}\n"
exit 0