-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_apps.sh
87 lines (68 loc) · 2.58 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
83
84
85
86
87
#!/bin/bash
name=$(cat /tmp/user_name)
apps_path="/tmp/apps.csv"
# Don't forget to replace "benjaminshawki" by the username of your Github account
curl https://raw.githubusercontent.com/benjaminshawki\
/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 they wish 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
"audio" "Audio tools" on
"i3" "i3 wm" on
"zsh" "The Z-Shell (zsh)" on
"neovim" "Neovim" on
"alacritty" "Alacritty" on
"browsers" "Chrome and Firefox" on
"js" "JavaScript tooling" on
"documents" "Documents tools" on
"virtualization" "Virtualization tools" on
"database" "Database tools" on
)
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
# Don't forget to replace "benjaminshawki" by the username of your Github account
curl https://raw.githubusercontent.com/benjaminshawki\
/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