-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathkickstart-void.sh
More file actions
executable file
·346 lines (297 loc) · 7.4 KB
/
kickstart-void.sh
File metadata and controls
executable file
·346 lines (297 loc) · 7.4 KB
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
#!/usr/bin/env bash
#
# Script to kickstart my main production machine (Void Linux).
#
# Author: David Anguita <david@davidanguita.name>
#
# Run me with:
#
# $ ./kickstart-void.sh
set -e
readonly DOTFILES_PATH="$HOME/workspace/dotfiles"
readonly DOTFILES_REPO_URL="https://github.com/danguita/dotfiles.git"
readonly DWM_REPO_URL="https://github.com/danguita/dwm.git"
readonly SLSTATUS_REPO_URL="https://github.com/danguita/slstatus.git"
say() {
printf "\n[$(date --iso-8601=seconds)] %b\n" "$1"
}
# shellcheck disable=SC2317
confirm() {
while true; do
read -r -p "$1 (y/[n]): " answer
case $answer in
[Yy]* ) return 0; break;;
[Nn]* ) return 1; break;;
"" ) return 1; break;;
* ) echo "Please answer yes or no.";;
esac
done
}
install_package() {
sudo xbps-install -y "$@"
}
install_flatpak_package() {
sudo flatpak install -y flathub "$@"
}
clean_packages() {
sudo xbps-remove -Ooy # Clean cache and remove orphan packages.
}
enable_service() {
[ ! -e "/var/service/$1" ] && sudo ln -s "/etc/sv/$1" /var/service/ || return 0
}
add_user_to_group() {
sudo usermod -a -G "$1" "$USER"
}
install_dotfiles() {
mkdir -p "$DOTFILES_PATH"
git clone --recurse-submodules "$DOTFILES_REPO_URL" "$DOTFILES_PATH"
make -C "$DOTFILES_PATH" install
}
update_dotfiles() {
make -C "$DOTFILES_PATH" update
}
install_dwm() {
rm -rf "$HOME/tmp/dwm"
git clone --depth 1 "$DWM_REPO_URL" "$HOME/tmp/dwm"
sudo make -C "$HOME/tmp/dwm" deploy
}
install_slstatus() {
rm -rf "$HOME/tmp/slstatus"
git clone --depth 1 "$SLSTATUS_REPO_URL" "$HOME/tmp/slstatus"
sudo make -C "$HOME/tmp/slstatus" deploy
}
main() {
# DHCP service is not enabled by default.
enable_service dhcpcd
# Create installation directories.
say "Creating installation directories"
mkdir -p "$HOME/tmp"
mkdir -p "$HOME/.config"
# Repositories.
say "Adding nonfree repository"
install_package void-repo-nonfree
# Base packages.
say "Installing base packages"
sudo xbps-install -Su # Sync and update.
install_package \
base-system \
base-devel \
xorg-minimal \
xrdb \
xsetroot \
xset \
setxkbmap \
xinit \
xinput \
xtools \
acpilight \
xclip \
xdotool \
xrandr \
xterm \
xdg-utils xdg-user-dirs xdg-dbus-proxy \
xdg-desktop-portal xdg-desktop-portal-gtk \
xurls \
xbindkeys \
dmenu j4-dmenu-desktop \
dbus dbus-x11 \
elogind \
polkit \
acpi \
tlp \
wget \
curl \
sed \
shellcheck \
bind-utils \
net-tools \
openntpd \
git lazygit \
gist \
gnupg \
libX11-devel libXft-devel libXinerama-devel \
pulseaudio pulsemixer pamixer pavucontrol \
sof-firmware \
playerctl \
ranger \
w3m w3m-img \
linux-firmware linux-firmware-network wifi-firmware \
linux linux-headers \
linux-lts linux-lts-headers \
fwupd \
dunst \
batsignal \
vim vim-x11 neovim \
ctags \
tmux \
tig \
scrot \
feh \
zathura zathura-pdf-mupdf \
mpv \
bash-completion \
the_silver_searcher \
dejavu-fonts-ttf \
google-fonts-ttf \
terminus-font \
firefox \
adwaita-icon-theme \
slock \
pcmanfm \
gvfs \
xarchiver \
htop \
gawk \
nodejs \
jq \
rsync \
keepassxc \
rclone \
fzf
# Access to removable storage devices.
add_user_to_group storage
# Ability to use KVM for virtual machines, e.g. via QEMU.
add_user_to_group kvm
# NTP daemon.
enable_service ntpd
# Seat management.
enable_service dbus
enable_service polkitd
# Power management.
enable_service tlp
# OpenSSH.
install_package openssh
enable_service sshd
# NetworkManager.
install_package NetworkManager NetworkManager-openvpn
enable_service NetworkManager
add_user_to_group network
# Docker.
if confirm "Docker"; then
install_package docker docker-compose
enable_service docker
add_user_to_group docker
fi
# Ruby.
if confirm "Ruby dev tools"; then
install_package ruby ruby-devel ruby-ri
sudo gem install bundler solargraph
fi
# Chromium.
if confirm "Chromium"; then
install_package chromium
fi
# Set default browser.
/usr/bin/xdg-settings set default-web-browser chromium.desktop || \
/usr/bin/xdg-settings set default-web-browser firefox.desktop || \
true
# Create user directories.
/usr/bin/xdg-user-dirs-update || true
mkdir -p "$HOME/Pictures/screenshots"
mkdir -p "$HOME/.local/bin"
mkdir -p "$HOME/.local/state"
mkdir -p "$HOME/.local/share/fonts"
# Flatpak.
#
# Installing apps:
#
# % flatpak install -y flathub com.slack.Slack
#
# Sandboxing: Allow access to host filesystem:
#
# % flatpak override com.slack.Slack --filesystem=xdg-download
# % flatpak override org.xonotic.Xonotic --filesystem=~/.xonotic
if confirm "Flatpak"; then
install_package flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
if confirm "Fltapak applications"; then
install_flatpak_package com.discordapp.Discord # Discord
install_flatpak_package com.getpostman.Postman # Postman
install_flatpak_package com.slack.Slack # Slack
install_flatpak_package com.spotify.Client # Spotify
install_flatpak_package us.zoom.Zoom # Zoom
fi
# Intel microcode.
if confirm "Intel CPU"; then
say "Installing drivers"
install_package linux-firmware-intel intel-ucode
fi
# Intel GPU.
if confirm "Intel GPU"; then
say "Installing drivers"
install_package linux-firmware-intel intel-media-driver mesa-vulkan-intel
fi
# AMD microcode.
if confirm "AMD CPU"; then
install_package linux-firmware-amd
fi
# AMD GPU (amdgpu).
if confirm "AMD GPU (amdgpu)"; then
install_package linux-firmware-amd xf86-video-amdgpu
fi
# NVIDIA GPU (nvidia).
if confirm "NVIDIA GPU (nvidia)"; then
install_package linux-firmware-nvidia nvidia nvidia-dkms
fi
# Extra file system: NTFS.
if confirm "NTFS support"; then
install_package ntfs-3g
fi
# Extra file system: ExFAT.
if confirm "ExFAT support"; then
install_package fuse-exfat exfat-utils
fi
# Printing/Scanning tools.
# % hp-plugin to download HP drivers.
if confirm "Printing/Scanning tools"; then
install_package \
cups \
hplip \
sane xsane \
simple-scan \
system-config-printer
enable_service cupsd
add_user_to_group lpadmin
add_user_to_group lp
add_user_to_group scanner
# Enable hpaio backend.
echo hpaio | sudo tee -a /etc/sane.d/dll.conf
fi
# Bluetooth support.
if confirm "Bluetooth support"; then
install_package blueman bluez
enable_service bluetoothd
add_user_to_group bluetooth
fi
# Install dotfiles.
if [ -d "$DOTFILES_PATH" ]; then
if confirm "Dotfiles found. Update?"; then
say "Updating dotfiles"
update_dotfiles
fi
else
say "Installing dotfiles"
install_dotfiles
fi
# Install dwm (window manager).
if [ -x "$(command -v dwm)" ]; then
confirm "dwm found. Update?" && install_dwm
else
install_dwm
fi
# Install slstatus (status monitor).
if [ -x "$(command -v slstatus)" ]; then
confirm "slstatus found. Update?" && install_slstatus
else
install_slstatus
fi
# Clean packages.
say "Cleaning things up"
clean_packages
# Finish up.
say "All done :tada:"
}
if [ "${1}" != "--source-only" ]; then
main "${@}"
fi