-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_once_arch_linux.bash.tmpl
executable file
·213 lines (171 loc) · 7.62 KB
/
run_once_arch_linux.bash.tmpl
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
#!/bin/bash
if [[ "${EUID}" == 0 ]]; then
PACMANCMD=( pacman )
SYSTEMCTLCMD=( systemctl )
else
PACMANCMD=( sudo pacman )
SYSTEMCTLCMD=( sudo systemctl )
fi
PACMANINSTALLCMD=( "${PACMANCMD[@]}" -Sq --needed --noconfirm )
PACMANQUERYCMD=( "${PACMANCMD[@]}" -Qqi )
PACMANUPDATECMD=( "${PACMANCMD[@]}" -Syuq --noconfirm )
PACMANLOCALINSTALLCMD=( "${PACMANCMD[@]}" -Uq --noconfirm )
YAYCMD=( yay )
YAYINSTALLCMD=( "${YAYCMD[@]}" -Sq --needed --noconfirm )
YAYUPDATECMD=( "${YAYCMD[@]}" -Syuaq --noconfirm )
SYSTEMCTLENABLECMD=( "${SYSTEMCTLCMD[@]}" -q enable )
SYSTEMCTLSTARTCMD=( "${SYSTEMCTLCMD[@]}" -q start )
NODEVERSION="lts/dubnium"
NPMCMD=( npm )
NPMINSTALLCMD=( "${NPMCMD[@]}" install -g )
NPMLOCALFINDCMD=( "${NPMCMD[@]}" ls -g )
PIPCMD=( pip )
PIPINSTALLCMD=( "${PIPCMD[@]}" install )
function pip_local_find {
"${PIPCMD[@]}" list | ack "$1"
}
GEMCMD=( gem )
GEMINSTALLCMD=( "${GEMCMD[@]}" install )
GEMLOCALFINDCMD=( "${GEMCMD[@]}" list -lie )
# TODO: move setup code into another script
# "${PACMANCMD[@]}" ${PACMANINSTALLFLAGS[@]} reflector
# sudo reflector -l 100 --sort rate --save /etc/pacman.d/mirrorlist
# Uncomment if broadcom wireless driver is needed
# "${PACMANCMD[@]}" ${PACMANINSTALLFLAGS[@]} broadcom-wl-dkms
# sudo modprobe wl
# sudo echo "wl" >> /etc/modules-load.d/modprobe.conf
# Uncomment if on Intel processor
# "${PACMANCMD[@]}" ${PACMANINSTALLFLAGS[@]} intel-ucode mesa lib32-mesa vulkan-intel
# sudo grub-mkconfig -o /boot/grub/grub.cfg
# echo "Remember to edit /etc/mkinitcpio.conf to enable KVM"
# Activate software
# Uncomment for GNOME
# sudo systemctl enable gdm.service
# gsettings set org.gnome.desktop.interface gtk-theme Adapta-Eta
# Uncomment for XFCE
#"${SYSTEMCTLENABLECMD[@]}" lightdm.service
#echo "Remember to set greeter in /etc/lightdm/lightdm.conf!"
#"${SYSTEMCTLENABLECMD[@]}" docker.service
#"${SYSTEMCTLSTARTCMD[@]}" docker.service
#"${SYSTEMCTLENABLECMD[@]}" NetworkManager.service
#"${SYSTEMCTLSTARTCMD[@]}" NetworkManager.service
# Arch Linux packages
BASE_DEVEL=(autoconf automake binutils bison fakeroot file findutils flex gawk gcc gettext grep groff gzip libtool m4 make pacman patch pkgconf sed sudo systemd texinfo util-linux which)
DEV=("${BASE_DEVEL[@]}" ack blender chezmoi cmake docker docker-compose exa git git-lfs gimp inkscape jdk-openjdk mono neovim python-neovim python python-pip python2 ruby tmux vagrant virtualbox virtualbox-guest-iso virtualbox-guest-utils zsh)
# Uncomment to enable gnome
#GNOME=(file-roller gdm gnome-backgrounds gnome-boxes gnome-calculator gnome-characters gnome-clocks gnome-color-manager gnome-control-center gnome-disk-utility gnome-font-viewer gnome-getting-started-docs gnome-logs gnome-menus gnome-remote-desktop gnome-screenshot gnome-session gnome-settings-daemon gnome-shell gnome-system-monitor gnome-terminal gnome-themes-extra gnome-user-docs gvfs gvfs-afc gvfs-goa gvfs-google gvfs-gphoto2 gvfs-mtp gvfs-nfs gvfs-smb mousetweaks mutter nautilus rygel simple-scan sushi tracker tracker-miners xdg-user-dirs-gtk yelp)
#GNOMEEXTRA=(chrome-gnome-shell dconf-editor gnome-nettool gnome-tweaks gnome-usage)
# Uncomment to enable xfce
XFCE=(exo garcon thunar thunar-media-tags-plugin thunar-volman tumbler xfce4-appfinder xfce4-artwork xfce4-datetime-plugin xfce4-dev-tools xfce4-fsguard-plugin xfce4-netload-plugin xfce4-notifyd xfce4-panel xfce4-power-manager xfce4-pulseaudio-plugin xfce4-screenshooter xfce4-session xfce4-settings xfce4-systemload-plugin xfce4-taskmanager xfce4-terminal xfconf xfdesktop xfwm4 xfwm4-themes xfce4-battery-plugin xfce4-clipman-plugin xfce4-cpufreq-plugin xfce4-cpugraph-plugin xfce4-datetime-plugin xfce4-diskperf-plugin xfce4-fsguard-plugin xfce4-netload-plugin xfce4-notifyd xfce4-sensors-plugin xfce4-xkb-plugin)
XFCESUPPLEMENT=(lightdm lightdm-gtk-greeter lxtask pavucontrol)
INPUTMETHOD=(fcitx fcitx-configtool fcitx-gtk2 fcitx-gtk3 fcitx-qt5 fcitx-googlepinyin fcitx-mozc)
NETWORK=(networkmanager)
THEMING=(adapta-gtk-theme compton gtk-engine-murrine noto-fonts noto-fonts-cjk noto-fonts-emoji ttf-roboto)
OTHERS=(alsa-utils baobab efibootmgr evince btrfs-progs gnome-keyring grub keepass libsecret mpv ntp perl-rename pulseaudio seahorse xclip xdotool xf86-input-libinput xorg-xinput xsel)
AURDEV=(android-studio bfg gitflow-avh nvm unityhub)
AURINTERNET=(google-chrome discord)
AURENTERTAINMENT=(spotify)
AUROTHERS=(debtap lightdm-slick-greeter nerd-fonts-complete powerline-fonts-git python2-neovim ulauncher)
# Packages needed only at work
{{- if contains "bottle" .chezmoi.hostname }}
AURWORK=(synology-drive)
{{- else }}
AURWORK=()
{{- end }}
AURPACKAGES=("${AURDEV[@]}" "${AURINTERNET[@]}" "${AURENTERTAINMENT[@]}" "${AUROTHERS[@]}" "${AURWORK[@]}")
PACMANPACKAGES=("${DEV[@]}" "${GNOME[@]}" "${GNOMEEXTRA[@]}" "${XFCE[@]}" "${XFCESUPPLEMENT[@]}" "${INPUTMETHOD[@]}" "${NETWORK[@]}" "${DESKTOPAPPS[@]}" "${THEMING[@]}" "${OTHERS[@]}")
NPMPACKAGES=(expo-cli react-native-cli neovim)
PIPPACKAGES=(neovim powerline-status)
GEMPACKAGES=(tmuxinator gist)
PACMANMANAGEDPACKAGES=("${AURPACKAGES[@]}" "${PACMANPACKAGES[@]}")
function try_install_pacman_packages {
local install_pacman_packages=false
for package in "${PACMANMANAGEDPACKAGES[@]}"; do
if [[ ! $("${PACMANQUERYCMD[@]}" "$package") ]]; then
install_pacman_packages=true
fi
done
if [[ "$install_pacman_packages" = false ]]; then
echo "All pacman packages installed already."
return
else
echo "Pacman packages missing. Continuing install."
fi
# Install packages from official repositories
"${PACMANUPDATECMD[@]}"
"${PACMANINSTALLCMD[@]}" ${PACMANPACKAGES[@]}
# Install packages from AUR
if [ ! -x /usr/bin/yay ]; then
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
"${PACMANLOCALINSTALLCMD[@]}" yay*.pkg.xz
cd ..
rm -rf yay
fi
"${YAYUPDATECMD[@]}"
"${YAYINSTALLCMD[@]}" ${AURPACKAGES[@]}
{{- if contains "bott" .chezmoi.hostname }}
if ! pacman -Qqs "chat"; then
chatname='Chat_1.0.1-40_amd64.deb'
chaturl="https://global.download.synology.com/download/Tools/ChatClient/1.0.1-40/Ubuntu/x86_64/Chat_1.0.1-40_amd64.deb?model=DS1517&bays=5&dsm_version=6.2.2&build_number=24922"
curl "${chaturl}" > "${chatname}"
debtap "${chatname}"
fi
{{- end }}
}
# External non-arch packages
function try_install_npm_packages {
if [[ ! $(type "${NPMCMD[@]}") ]]; then
nvm install "${NODEVERSION}"
nvm use "${NODEVERSION}"
fi
local install_npm_packages=false
for package in "${NPMPACKAGES[@]}"; do
if [[ ! $("${NPMLOCALFINDCMD[@]}" "$package") ]]; then
install_npm_packages=true
fi
done
if [[ "$install_npm_packages" = false ]]; then
echo "All npm packages already installed."
return
else
echo "npm packages missing. Continuing install."
fi
"${NPMINSTALLCMD[@]}" ${NPMPACKAGES[@]}
}
function try_install_pip_packages {
local install_pip_packages=false
for package in "${PIPPACKAGES[@]}"; do
if [[ ! $(pip_local_find "$package") ]]; then
install_pip_packages=true
fi
done
if [[ "$install_pip_packages" = false ]]; then
echo "All pip packages already installed."
return
else
echo "$package missing"
echo "Pip packages missing. Continuing install."
fi
"${PIPINSTALLCMD[@]}" ${PIPPACKAGES[@]}
}
function try_install_gems {
local install_gems=false
for package in "${GEMS[@]}"; do
if [[ ! $("${GEMLOCALFINDCMD[@]}" "$package") ]]; then
install_gems=true
fi
done
if [[ "$install_gems" = false ]]; then
echo "All gems already installed."
return
else
echo "Gems missing. Continuing install."
fi
"${GEMINSTALLCMD[@]}" ${GEMS[@]}
}
try_install_pacman_packages
try_install_npm_packages
try_install_pip_packages
try_install_gems