-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathbootstrap.arch.sh
executable file
·296 lines (272 loc) · 8.79 KB
/
bootstrap.arch.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
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
#!/bin/bash
set -eo pipefail
CURRDIR=`pwd`
SCRIPTDIR=$(cd `dirname $0` && pwd)
. ${SCRIPTDIR}/config.sh
# allow access to /usr/local and subdirs for group wheel
if [[ ! -w /usr/local/man/man1 ]]; then
for i in {1..8}; do
mkdir -p /usr/local/man/man${i}
done
for d in $(find /usr/local -type d); do
chown root:wheel ${d}
chmod g+w ${d}
done
fi
# enable parallel downloads for pacman
set +e
grep -E '^#ParallelDownloads' /etc/pacman.conf >/dev/null
if [[ "$?" = "0" ]]; then
set -e
echo
echo "enabling parallel downloads (5) for pacman"
doas sed -i -e 's/^#ParallelDownloads .*/ParallelDownloads = 5/g' /etc/pacman.conf
else
set -e
fi
# install paru
set +e
type paru >/dev/null 2>&1
if [[ "$?" != "0" ]]; then
set -e
echo
echo "installing paru"
doas pacman -Sy ${NOCONFIRM} --needed rustup $(cat ${SCRIPTDIR}/bootstrap.packages/arch.base-devel.txt)
rustup default stable
mkdir -p ~/tmp
cd ~/tmp
rm -rf paru
git clone https://aur.archlinux.org/paru.git
cd paru
makepkg -si
cd ~/tmp
rm -rf paru
cd ${CURRDIR}
else
set -e
fi
# symlink configs
cd ~/.config
[[ ! -L dunst ]] && ln -s $SCRIPTDIR/config/dunst dunst
[[ ! -L fuzzel ]] && ln -s $SCRIPTDIR/config/fuzzel fuzzel
[[ ! -L mako ]] && ln -s $SCRIPTDIR/config/mako mako
[[ ! -L paru ]] && ln -s $SCRIPTDIR/config/paru paru
[[ ! -L sway ]] && ln -s $SCRIPTDIR/config/sway sway
[[ ! -L swaylock ]] && ln -s $SCRIPTDIR/config/swaylock swaylock
[[ ! -L swaynag ]] && ln -s $SCRIPTDIR/config/swaynag swaynag
[[ ! -L waybar ]] && ln -s $SCRIPTDIR/config/waybar waybar
mkdir -p systemd/user
cd systemd/user
for f in $(find ${SCRIPTDIR}/systemd/user -maxdepth 1 -type f); do
if [[ ! -L $(basename ${f}) ]]; then
ln -s ${f}
systemctl --user enable --now $(basename ${f})
fi
done
# update all the things
echo
echo "updating / installing / cleaning packages"
paru -Syu ${NOCONFIRM}
paru -S ${NOCONFIRM} --needed $(cat ${SCRIPTDIR}/bootstrap.packages/arch.* |sort -u)
paru -c ${NOCONFIRM}
paru -Scc --noconfirm # always clear caches
# add usbhid module
doas modprobe -v usbhid
if [[ ! -f /etc/modules-load.d/usbhid.conf ]]; then
echo "usbhid" |doas tee -a /etc/modules-load.d/usbhid.conf
fi
# add user to seat if need be
set +e
id -nG ${USER} |grep -qw seat
if [[ "$?" != "0" ]]; then
echo
echo "adding ${USER} to seat"
doas usermod -a -G seat ${USER}
else
set -e
fi
# enable seatd at boot
set +e
doas systemctl is-enabled seatd.service >/dev/null
if [[ "$?" != "0" ]]; then
set -e
echo
echo "enabling seatd.service"
doas systemctl enable --now seatd.service
else
set -e
fi
# enable pipewire.service at boot
set +e
systemctl --user is-enabled pipewire.service >/dev/null
if [[ "$?" != "0" ]]; then
set -e
echo
echo "enabling pipewire.service"
systemctl --user enable --now pipewire.service
else
set -e
fi
# enable docker.service at boot
set +e
doas systemctl is-enabled docker.service >/dev/null
if [[ "$?" != "0" ]]; then
set -e
echo
echo "enabling docker.service"
doas systemctl enable --now docker.service
doas usermod -aG docker $USER
else
set -e
fi
# enable reflector.service and reflector.timer at boot
set +e
doas systemctl is-enabled reflector.service >/dev/null
if [[ "$?" != "0" ]]; then
set -e
echo
echo "enabling reflector.service"
doas systemctl enable --now reflector.service
else
set -e
fi
set +e
doas systemctl is-enabled reflector.timer >/dev/null
if [[ "$?" != "0" ]]; then
set -e
echo
echo "enabling reflector.timer"
doas systemctl enable --now reflector.timer
else
set -e
fi
# remap keys
echo
echo "remapping keys"
doas mkdir -p /etc/kbct
[[ ! -L /etc/kbct/config.yml ]] && doas ln -s ${SCRIPTDIR}/kbct-config.yml /etc/kbct/config.yml
set +e
doas systemctl is-enabled kbct.service >/dev/null
if [[ "$?" != "0" ]]; then
set -e
echo
echo "enabling kbct.service"
doas modprobe -v uinput
if [[ ! -f /etc/modules-load.d/uinput.conf ]]; then
echo "uinput" |doas tee -a /etc/modules-load.d/uinput.conf
fi
doas systemctl enable --now kbct.service
else
set -e
doas systemctl restart kbct.service
fi
# fixes for native wayland
echo
echo "waylandifying applications"
cd ~/.config
[[ ! -L electron-flags.conf ]] && ln -s ${SCRIPTDIR}/config/electron-flags.conf
[[ ! -L chromium-flags.conf ]] && ln -s ${SCRIPTDIR}/config/chromium-flags.conf
[[ ! -L brave-flags.conf ]] && ln -s ${SCRIPTDIR}/config/chromium-flags.conf brave-flags.conf
cd ${CURRDIR}
mkdir -p ~/.local/share/applications
for f in tidal-hifi; do # brave-browser would need to be here to if we use it
echo "-> ${f}"
rm -f ~/.local/share/applications/${f}.desktop
cp /usr/share/applications/${f}.desktop ~/.local/share/applications/
sed -i -e 's/^Exec=\([^ ]*\)\(.*\)$/Exec=\1 --ozone-platform-hint=auto\2/g' ~/.local/share/applications/${f}.desktop
done
# blacklist some applications from launchers
for app in $(cat ${SCRIPTDIR}/launcher-blacklist.txt); do
if [[ -f /usr/share/applications/${app} ]]; then
echo "-> blacklisting ${app} from launcher"
cp /usr/share/applications/${app} ~/.local/share/applications/${app}
echo "NoDisplay=true" >>~/.local/share/applications/${app}
fi
done
# fix icons
cp /usr/share/applications/org.codeberg.dnkl.foot.desktop ~/.local/share/applications/org.codeberg.dnkl.foot.desktop
sed -i -e 's/^Icon=.*$/Icon=terminal/g' ~/.local/share/applications/org.codeberg.dnkl.foot.desktop
cp /usr/share/applications/pulse.desktop ~/.local/share/applications/pulse.desktop
sed -i -e 's/^Icon=.*$/Icon=bitwarden/g' ~/.local/share/applications/pulse.desktop
cp /usr/share/applications/firefox.desktop ~/.local/share/applications/firefox.desktop
sed -i -e 's/^Icon=.*$/Icon=firefox-developer-icon/g' ~/.local/share/applications/firefox.desktop
# update database
update-desktop-database -v ~/.local/share/applications
# theming ----------------------------------------------------------------------------------------------------------------------------
NORDIC_DIR=${TWEAKS_DIR}/nordic
NORDZY_DIR=${TWEAKS_DIR}/nordzy
NORDIC_VERSION_FILE=${TWEAKS_DIR}/nordic_version
# Nordic theme
EXISTING_NORDIC_VERSION=none
if [[ -f ${NORDIC_VERSION_FILE} ]]; then
EXISTING_NORDIC_VERSION=$(cat ${NORDIC_VERSION_FILE})
fi
if [[ ${NORDIC_VERSION} != ${EXISTING_NORDIC_VERSION} ]]; then
echo
echo "installing nordic theme version ${NORDIC_VERSION}"
mkdir -p ~/.local/share/themes
cd ~
[[ ! -L .themes ]] && ln -s ~/.local/share/themes .themes
cd ~/.local/share/themes
rm -rf ${NORDIC_THEME}
wget https://github.com/EliverLara/Nordic/releases/latest/download/${NORDIC_THEME}.tar.xz
tar -xf ${NORDIC_THEME}.tar.xz
rm ${NORDIC_THEME}.tar.xz
echo ${NORDIC_VERSION} >${NORDIC_VERSION_FILE} # do this at the end so we run through this again if we fail
fi
cd ${CURRDIR}
# Nordic firefox theme
mkdir -p ${NORDIC_DIR}
[[ ! -d "${NORDIC_DIR}/firefox-nordic-theme" ]] && \
git clone https://github.com/EliverLara/firefox-nordic-theme ${NORDIC_DIR}/firefox-nordic-theme
cd ${NORDIC_DIR}/firefox-nordic-theme
if [[ "$(git pull 2>&1)" != "Already up to date." ]]; then
echo
echo "installing nordic firefox theme"
./scripts/install.sh
fi
# Nordzy Icons
echo
echo "installing nordzy icons"
mkdir -p ${NORDZY_DIR}
[[ ! -d ${NORDZY_DIR}/icons ]] && git clone https://github.com/alvatip/Nordzy-icon ${NORDZY_DIR}/icons
cd ${NORDZY_DIR}/icons
git pull
./install.sh
cp ~/dotfiles/icons/tidal.png ~/.icons/Nordzy-dark/apps/scalable/
[[ ! -L ~/.icons/Nordzy-dark/apps/scalable/tidal-hifi.png ]] && \
ln -s ~/.icons/Nordzy-dark/apps/scalable/tidal.png ~/.icons/Nordzy-dark/apps/scalable/tidal-hifi.png
cd ${CURRDIR}
# Nordzy Cursors
echo
echo "installing nordzy cursors"
mkdir -p ${NORDZY_DIR}
[[ ! -d ${NORDZY_DIR}/cursors ]] && git clone https://github.com/alvatip/Nordzy-cursors ${NORDZY_DIR}/cursors
cd ${NORDZY_DIR}/cursors
git pull
./install.sh
cd ~/.icons
[[ ! -L default ]] && ln -s Nordzy-cursors default
cd ${CURRDIR}
# Attempt to actually set theme in various ways
gsettings set org.gnome.desktop.interface color-scheme prefer-dark
gsettings set org.gnome.desktop.interface gtk-theme "${NORDIC_THEME}"
gsettings set org.gnome.desktop.interface icon-theme 'Nordzy-dark'
gsettings set org.gnome.desktop.interface cursor-theme 'Nordzy-cursors'
gsettings set org.gnome.desktop.wm.preferences theme "${NORDIC_THEME}"
mkdir -p ~/.config/gtk-4.0
cd ~/.config/gtk-4.0
[[ ! -L settings.ini ]] && ln -s ${SCRIPTDIR}/config/gtk-4.0/settings.ini
cp -a ~/.local/share/themes/${NORDIC_THEME}/gtk-4.0/gtk-dark.css ~/.config/gtk-4.0/gtk-dark.css
cp -a ~/.local/share/themes/${NORDIC_THEME}/gtk-4.0/gtk.css ~/.config/gtk-4.0/gtk.css
cd ~/.config
[[ ! -L gtk-3.0 ]] && ln -s ${SCRIPTDIR}/config/gtk-3.0
[[ ! -L Trolltech.conf ]] && ln -s ${SCRIPTDIR}/config/Trolltech.conf
cd ~
[[ ! -L .gtkrc-2.0 ]] && ln -s ${SCRIPTDIR}/gtkrc-2.0 .gtkrc-2.0
cd ${CURRDIR}
mkdir -p ${HOME}/tmp
cat <<EOF >>${HOME}/tmp/bootstrap_TODO
- logout and login to finish seatd install
EOF
cd ${CURRDIR}