-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·188 lines (152 loc) · 2.46 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
#!/bin/bash
if [ "$EUID" -ne 0 ]
then
echo "Script must be run as root"
exit
fi
doRun()
{
filename="RESUME.tmp"
if [ ! -f "$filename" ]; then
setStep 0;
fi
if [ -f "tmpConfigFile.tmp" ]; then
source ./tmpConfigFile.tmp
fi
step=$(head -n 1 $filename);
chmodScripts;
setVariables;
if [ $step -lt 3 ]; then
requestInput;
fi
if [ $step -lt 4 ]; then
installPackmanPackages;
fi
if [ $step -lt 5 ]; then
enableSnapService;
fi
if [ $step -lt 6 ]; then
installSnapPackages;
fi
if [ $step -lt 7 ]; then
installAurPackages;
fi
if [ $step -lt 8 ]; then
installAppImages;
fi
if [ $step -lt 9 ]; then
configureUfw;
fi
if [ $step -lt 10 ]; then
configureZsh;
fi
if [ $step -lt 11 ]; then
configureGit;
fi
if [ $step -lt 12 ]; then
configureSsh;
fi
if [ $step -lt 13 ]; then
bumpVersion;
fi
if [ $step -lt 14 ]; then
configureSsh;
fi
if [ $step -lt 15 ]; then
removeTemporaryFiles;
fi
}
setStep()
{
filename="RESUME.tmp";
rm -f $filename;
echo $1 > $filename;
}
chmodScripts()
{
setStep 1;
chmod +x ./*.sh
chmod +x ./install/*.sh
chmod +x ./config/*.sh
}
setVariables()
{
setStep 2;
source ./set-variables.sh
}
requestInput()
{
setStep 3;
source ./request-input.sh
}
installPackmanPackages()
{
setStep 4;
source ./install/pacman-packages.sh
}
enableSnapService()
{
setStep 5;
source ./install/enable-snap-service.sh
}
installSnapPackages()
{
setStep 6;
source ./install/snap-packages.sh
}
installAurPackages()
{
setStep 7;
# source ./install/aur-packages.sh
}
installAppImages()
{
setStep 8;
source ./install/app-images.sh
}
configureUfw()
{
setStep 9;
source ./config/ufw-config.sh
}
configureZsh()
{
setStep 10;
source ./config/zsh-config.sh
}
configureGit()
{
setStep 11;
source ./config/git-config.sh
}
configureSsh()
{
setStep 12;
source ./config/ssh-config.sh
}
bumpVersion()
{
setStep 13;
source ./bump-version.sh
}
configureSsh()
{
setStep 14;
# Change ownership of home folder files recursively
echo "Changing ownership of home folder..."
chown -R "$LOGNAME:$LOGNAME" "$HOMEDIR"
}
removeTemporaryFiles()
{
setStep 15;
rm -f "RESUME.tmp";
rm -f "tmpConfigFile.tmp";
}
while true; do
read -rp "Continue with installation? (y/n)" yn
case $yn in
[Yy]* ) doRun; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done