-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_apps.sh
90 lines (70 loc) · 2.64 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
88
89
90
#!/bin/bash
name=$(cat /user_name)
apps_path="/apps.csv"
curl https://raw.githubusercontent.com/josef-o/arch_installer/master/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 wm" on
"zsh" "The Z-Shell (zsh)" on
"neovim" "Neovim" on
"urxvt" "URxvt" on
"firefox" "Firefox (browser)" on
"js" "JavaScript tooling" on
"qutebrowser" "Qutebrowser (browser)" on
"lynx" "Lynx (browser)" on
"hardware" "Hadware" on
"fonts" "Fonts" on
"misc" "Miscellaneous" on
"python" "Python" 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
# Uncomment to set the keymap you want. Replace "fr" by your country code
if [ "$line" = "xorg" ]; then
localectl --no-convert set-x11-keymap us " " colemak
fi
if [ "$line" = "networkmanager" ]; then
systemctl enable NetworkManager.service
fi
done
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
curl https://raw.githubusercontent.com/josef-o/arch_installer/master/install_user.sh > /install_user.sh;
# Switch user and run the final script
sudo -u "$name" sh /install_user.sh