-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
executable file
·195 lines (179 loc) · 3.57 KB
/
init.sh
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#!/bin/bash
lsb=$(lsb_release -a 2>/dev/null | grep Release | awk '{ print $2}')
allprogs=(curl curl emacs emacs gcc gcc ifconfig net-tools inxi inxi make build-essential ssh ssh terminator terminator);
allprogsPost=(emacs emacs npm npm);
NORM="$(tput sgr0)"
BOLD="$(tput bold)"
REV="$(tput smso)"
UND="$(tput smul)"
BLACK="$(tput setaf 0)"
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 90)"
MAGENTA1="$(tput setaf 91)"
MAGENTA2="$(tput setaf 92)"
MAGENTA3="$(tput setaf 93)"
GREY="$(tput setaf 240)"
CYAN="$(tput setaf 6)"
WHITE="$(tput setaf 7)"
ORANGE="$(tput setaf 172)"
ERROR="${REV}Error:${NORM}"
msg(){
if [[ $2 = "c" ]]; then
txt="${YELLOW}checking${NORM}"
elif [[ $2 = "i" ]]; then
txt="${ORANGE}installing${NORM}"
elif [[ $2 = "d" ]]; then
txt="${GREEN}installed${NORM}"
fi
size=${#1}
if [[ $size -lt 8 ]]; then
tabs="\t\t\t"
elif [[ $size -lt 15 ]]; then
tabs="\t\t"
elif [[ $size -lt 22 ]]; then
tabs="\t"
else
tabs=""
fi
echo -en "\r$1${tabs}$txt"
}
installif(){
check=$1
aptprogname="$2"
msg $1 c
which $check >> /dev/null
if [[ $? -ne 0 ]]; then
msg $1 i
sudo apt-get install -y $aptprogname
if [[ $? -ne 0 ]]; then
msg $1 e
else
msg $1 d
fi
else
msg $1 d
fi
echo ""
}
installnvmnode(){
name="nvm-node"
msg $name c
if [[ ! -e ~/.nvm/ ]]; then
msg $name i
pushd . >> /dev/null
cd /tmp
curl -sL https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh -o install_nvm.sh
echo "calling bash"
bash install_nvm.sh
msg $name d
else
msg $name d
fi
name="node"
which node >> /dev/null
if [[ $? -ne 0 ]]; then
msg $name c
source ~/.profile
whoami
source ~/.bashrc
nvm install 8.11.3
nvm use 8.11.3
if [[ $? -ne 0 ]]; then
msg $name e
else
msg $name d
fi
else
msg $name d
fi
echo ""
}
installsublimetext(){
msg sublime c
which subl >> /dev/null
if [[ $? -ne 0 ]]; then
pushd . >> /dev/null
cd /tmp
msg sublime i
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-add-repository "deb https://download.sublimetext.com/ apt/stable/"
sudo apt-get install sublime-text
if [[ $? -ne 0 ]]; then
msg sublime e
else
msg sublime d
fi
popd >> /dev/null
else
msg sublime d
fi
echo ""
}
installslack(){
msg slack c
which slack >> /dev/null
if [[ $? -ne 0 ]]; then
msg slack i
sudo snap install slack --classic
if [[ $? -ne 0 ]]; then
msg slack e
else
msg slack d
fi
else
msg slack d
fi
echo ""
}
installchrome(){
msg chrome c
which google-chrome >> /dev/null
if [[ $? -ne 0 ]]; then
msg chrome i
installif gdebi gdebi-core
pushd . >> /dev/null
cd /tmp
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo gdebi -n google-chrome-stable_current_amd64.deb
if [[ $1 -ne 0 ]]; then
msg chrome e
else
msg chrome d
fi
popd >> /dev/null
else
msg chrome d
fi
echo ""
}
installall(){
tLen=${#allprogs[@]}
for (( i=0; i<${tLen}; i+=2 )); do
check=${allprogs[$i]};
b=$(( $i + 1 ));
inst=${allprogs[$b]};
installif $check $inst
done
}
installallPost(){
tLen=${#allprogsPost[@]}
for (( i=0; i<${tLen}; i+=2 )); do
check=${allprogsPost[$i]};
b=$(( $i + 1 ));
inst=${allprogsPost[$b]};
installif $check $inst
done
}
diableAutomount() {
gsettings set org.gnome.desktop.media-handling automount false
}
installall
installslack
installnvmnode
installsublimetext
installchrome
installallPost
diableAutomount