-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_apps.sh
82 lines (63 loc) · 2.38 KB
/
install_apps.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
#!/bin/bash
name=$(cat /tmp/user_name)
apps_path="/tmp/apps.csv"
# Download apps.csv
curl https://raw.githubusercontent.com/ajkingio/arch_installer/main/apps.csv > $apps_path
dialog --title "Welcome!" \
--msgbox "Welcome to the install script for your apps and dotfiles!" \
10 60
# Allow the user to select the group of packages he (or she) wants to install.
apps=("essential" "Essentials" on
"network" "Network" on
"tools" "Nice tools to have (highly recommended)" on
"tmux" "Tmux" on
"notifier" "Notification tools" on
"git" "Git & git tools" on
"i3" "i3 gaps" on
"zsh" "The Z-Shell (zsh)" on
"neovim" "Neovim" on
"urxvt" "URxvt" on
"firefox" "Firefox (browser)" off
"js" "JavaScript tooling" off
"qutebrowser" "Qutebrowser (browser)" off
"lynx" "Lynx (browser)" off)
dialog --checklist \
"You can now choose what group of application you want to install. \n\n\
You can select an option with SPACE and valid your choices with ENTER." \
0 0 0 \
"${apps[@]}" 2> app_choices
choices=$(cat app_choices) && rm app_choices
# Create a regex to only select the packages we want
selection="^$(echo $choices | sed -e 's/ /,|^/g'),"
lines=$(grep -E "$selection" "$apps_path")
count=$(echo "$lines" | wc -l)
packages=$(echo "$lines" | awk -F, {'print $2'})
echo "$selection" "$lines" "$count" >> "/tmp/packages"
pacman -Syu --noconfirm
rm -f /tmp/aur_queue
dialog --title "Let's go!" --msgbox \
"The system will now install everything you need.\n\n\
It will take some time.\n\n " \
13 60
c=0
echo "$packages" | while read -r line; do
c=$(( "$c" + 1 ))
dialog --title "Arch Linux Installation" --infobox \
"Downloading and installing program $c out of $count: $line..." \
8 70
((pacman --noconfirm --needed -S "$line" > /tmp/arch_install 2>&1) \
|| echo "$line" >> /tmp/aur_queue) \
|| echo "$line" >> /tmp/arch_install_failed
if [ "$line" = "zsh" ]; then
# Set Zsh as default terminal for our user
chsh -s "$(which zsh)" "$name"
fi
if [ "$line" = "networkmanager" ]; then
systemctl enable NetworkManager.service
fi
done
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
# Downlosd install_user.sh
curl https://raw.githubusercontent.com/ajkingio/arch_installer/main/install_user.sh > /tmp/install_user.sh;
# Switch user and run the final script
sudo -u "$name" sh /tmp/install_user.sh