-
Notifications
You must be signed in to change notification settings - Fork 0
/
tempestos.sh
executable file
·280 lines (252 loc) · 7.02 KB
/
tempestos.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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
#!/bin/sh
# _____ _ _____ _____
# |_ _| | | | _ / ___|
# | | ___ _ __ ___ _ __ ___ ___| |_| | | \ `--.
# | |/ _ \ '_ ` _ \| '_ \ / _ \/ __| __| | | |`--. \
# | | __/ | | | | | |_) | __/\__ \ |_\ \_/ /\__/ /
# \_/\___|_| |_| |_| .__/ \___||___/\__|\___/\____/
# | |
# |_|
#
# TempestOS Arch Linux post-install script
# RUN THIS AT YOUR OWN RISK
# SCRIPT IS SAFE, BUT WILL OVERWRITE YOUR DOTFILES
# Globals
#################################################
arch_extra="packages/arch_extra.txt"
arch_required="packages/arch_required.txt"
aur_extra="packages/aur_extra.txt"
aur_required="packages/aur_required.txt"
# Functions
#################################################
confirm_prompt() {
prompt="$1"
while true; do
echo "$prompt (yes/no)"
echo -n "Answer: "
read -r answer
case "$answer" in
[Yy] | [Yy][Ee][Ss]) return 1 ;;
[Nn] | [Nn][Oo]) return 0 ;;
*) echo "Invalid input. Please enter 'yes' or 'no'." ;;
esac
done
}
install_system_config_files() {
confirm_prompt "Install system config files (/etc/pacman.conf, etc.)?"
if [ $? -eq 1 ]; then
sudo cp system/config/pacman.conf /etc/pacman.conf
sudo chmod -R u+rwX,go+rX,go-w /etc/pacman.conf
sudo chown -R -c root /etc/pacman.conf
else
echo "Skipping installing system config files..."
fi
}
install_arch_packages() {
arch_packages_file="$1"
arch_packages_type="$2"
if [ -f "$arch_packages_file" ]; then
confirm_prompt "Install $2 Arch packages?"
if [ $? -eq 1 ]; then
echo "Installing $arch_packages_type arch packages..."
while IFS= read -r package || [ -n "$package" ]; do
sudo pacman -S --needed --noconfirm "$package"
done <"$arch_packages_file"
else
echo "Skipping $arch_packages_type arch packages..."
fi
else
echo "$arch_packages_file not found"
confirm_prompt "Continue installation?"
[ $? -eq 1 ] || exit 0
fi
}
install_aur_packages() {
aur_packages_file="$1"
aur_packages_type="$2"
if [ -f "$aur_packages_file" ]; then
confirm_prompt "Install AUR packages?"
if [ $? -eq 1 ]; then
echo "Installing $aur_packages_type AUR packages..."
if ! command -v paru >/dev/null 2>&1; then
echo "Installing paru AUR helper..."
git clone https://aur.archlinux.org/paru-bin.git
(
cd paru-bin || exit
makepkg -si --noconfirm
cd ..
rm -rf paru-bin
)
fi
while IFS= read -r package || [ -n "$package" ]; do
paru -S --needed --noconfirm "$package"
done <"$aur_packages_file"
else
echo "Skipping $aur_packages_type AUR packages..."
fi
else
echo "$aur_packages_file not found"
confirm_prompt "Continue installation?"
[ $? -eq 1 ] || exit 0
fi
}
install_dotfiles() {
echo "*** ANSWERING YES WILL OVERWRITE YOUR CURRENT DOTFILES! ***"
echo "*** Make sure to back them up before continuing. ***"
echo
confirm_prompt "Install dotfiles?"
if [ $? -eq 1 ]; then
echo "Cloning dotfiles git repo to temp folder..."
git clone https://github.com/jagger-harris/dotfiles.git dotfiles_tmp
echo "Copying dotfiles to home directory..."
cp -a dotfiles_tmp/. "$HOME"
echo "Removing temp folder"
rm -rf dotfiles_tmp
else
echo "Skipping dotfiles..."
fi
}
install_lightdm() {
confirm_prompt "Install LightDM?"
if [ $? -eq 1 ]; then
sudo pacman -S --needed --noconfirm lightdm lightdm-gtk-greeter
sudo cp system/lightdm/lightdm.conf /etc/lightdm/
sudo cp system/lightdm/lightdm-gtk-greeter.conf /etc/lightdm/
sudo mkdir -p /usr/share/lightdm
sudo cp system/lightdm/blue_tempest.svg /usr/share/lightdm/
sudo chmod -R u+rwX,go+rX,go-w /etc/lightdm/
sudo chown -R -c root /etc/lightdm/
sudo chmod -R u+rwX,go+rX,go-w /usr/share/lightdm
sudo chown -R -c root /usr/share/lightdm
else
echo "Skipping LightDM..."
fi
}
install_gtk_theme() {
confirm_prompt "Install GTK theme?"
if [ $? -eq 1 ]; then
sudo cp -r system/themes/BlueSky-Clean-Dark /usr/share/themes/
sudo chmod -R u+rwX,go+rX,go-w /usr/share/themes/BlueSky-Clean-Dark
sudo chown -R -c root /usr/share/themes/BlueSky-Clean-Dark
else
echo "Skipping GTK theme..."
fi
}
# Main script
#################################################
clear
cat logo.txt
echo
echo "Welcome to the TempestOS Arch post-installation script!"
echo
if [ "$(id -u)" = 0 ]; then
echo "Detected installation script running as the root user."
echo "DO NOT RUN THE SCRIPT AS THE ROOT USER!"
exit 0
fi
echo "Follow instructions carefully. There are options to not install packages."
echo "However, it is recommended to answer (y/yes) to all of them."
echo
echo "Press ENTER to continue..."
head -n 1 >/dev/null
clear
# Update system and install necessary packages
cat logo.txt
echo
echo "0. Update system and install required packages"
echo
echo "Updating system and installing necessary packages..."
echo
sudo pacman -Syu --noconfirm
sudo pacman -S --needed --noconfirm base-devel git
clear
# Install system config files
cat logo.txt
echo
echo "1. Install system configuration files"
echo
echo "**REQUIRED**"
echo "**ANSWERING NO CAN LEAD TO AN UNSTABLE EXPERIENCE**"
echo
install_system_config_files
clear
# Configure LightDM
cat logo.txt
echo
echo "2. Install and Configure LightDM"
echo
echo "**REQUIRED**"
echo "**ANSWERING NO CAN LEAD TO AN UNSTABLE EXPERIENCE**"
echo
install_lightdm
clear
# Install required arch packages
cat logo.txt
echo
echo "3. Install required Arch packages"
echo
echo "**REQUIRED**"
echo "**ANSWERING NO CAN LEAD TO AN UNSTABLE EXPERIENCE**"
echo
install_arch_packages "$arch_required" "required"
clear
# Install extra arch packages
cat logo.txt
echo
echo "4. Install extra Arch packages"
echo
echo "**RECOMMENDED**"
echo "Not required for functionality, but recommonded for the full TempestOS experience."
echo
install_arch_packages "$arch_extra" "extra"
clear
# Install required AUR packages
cat logo.txt
echo
echo "5. Install required AUR packages"
echo
echo "**REQUIRED**"
echo "**ANSWERING NO CAN LEAD TO AN UNSTABLE EXPERIENCE**"
echo
install_aur_packages "$aur_required" "required"
clear
# Install extra AUR packages
cat logo.txt
echo
echo "6. Install extra AUR packages"
echo
echo "**RECOMMENDED**"
echo "Not required for functionality, but recommonded for the full TempestOS experience."
echo
install_aur_packages "$aur_extra" "extra"
clear
# Install dotfiles
cat logo.txt
echo
echo "7. Clone TempestOS dotfiles"
echo
echo "**RECOMMENDED**"
echo "Not required for functionality, but recommonded for the full TempestOS experience."
echo
install_dotfiles
clear
# Install GTK theme
cat logo.txt
echo
echo "7. Install GTK theme"
echo
echo "**RECOMMENDED**"
echo "Not required for functionality, but recommonded for the full TempestOS experience."
echo
install_gtk_theme
clear
# Completion
cat logo.txt
echo
echo "8. Completion"
echo
echo "TempestOS Arch post-installation script is completed!"
echo
echo "Press ENTER to exit..."
head -n 1 >/dev/null
clear