aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano@tronto.net>2026-05-14 09:48:31 +0200
committerSebastiano Tronto <sebastiano@tronto.net>2026-05-14 09:48:31 +0200
commite3af791378d051b791f8d1ca72e964555ecf75cf (patch)
tree019c53c6e0d5de449046ca6beb9e6c298aad1ff6 /src
parent93cbf681422d4fbb3e112b8b260d1bbc84c772fb (diff)
downloadsebastiano.tronto.net-e3af791378d051b791f8d1ca72e964555ecf75cf.tar.gz
sebastiano.tronto.net-e3af791378d051b791f8d1ca72e964555ecf75cf.zip
Add setup config script
Diffstat (limited to 'src')
-rwxr-xr-xsrc/setup-config-alpine162
1 files changed, 162 insertions, 0 deletions
diff --git a/src/setup-config-alpine b/src/setup-config-alpine
new file mode 100755
index 0000000..23cb6a8
--- /dev/null
+++ b/src/setup-config-alpine
@@ -0,0 +1,162 @@
1#!/bin/sh
2
3# Set up my configuration on a new Alpine Linux installation.
4
5print_log() {
6 printf '\n>>> %s \n\n' "$@"
7}
8
9set -e # Abort on first error
10
11
12print_log "Installing git and cloning the config repo"
13
14doas apk add git
15cd ~
16git init .
17git remote add origin https://git.tronto.net/config
18git fetch && git checkout -f master
19git remote set-url origin git@tronto.net:config
20git remote set-url origin --add --push git@github.com:sebastianotronto/config
21
22
23print_log "Installing software from alpine repositories"
24
25tmp_repo_file=$(mktemp)
26main_repo="$(grep main /etc/apk/repositories)"
27community_repo="$(echo "$main_repo" | sed 's/main/community/')"
28printf '%s\n%s\n' "$main_repo" "$community_repo" > "$tmp_repo_file"
29doas mv "$tmp_repo_file" /etc/apk/repositories
30
31./scripts/apkworld
32
33
34print_log "Installing and configuring desktop environment"
35
36doas setup-xorg-base
37
38mkdir -p src
39cd src
40for i in dmenu dwm st; do
41 git clone https://git.suckless.org/$i
42 cd $i
43 cp ~/.config/$i/config.h ./config.h
44 make && doas make install
45 cd ..
46done
47cd
48
49tmp_xorg_file=$(mktemp)
50cat <<EOF > "$tmp_xorg_file"
51Section "InputClass"
52 Identifier "libinput touchpad catchall"
53 MatchIsTouchpad "on"
54 MatchDevicePath "/dev/input/event*"
55 Driver "libinput"
56 Option "Tapping" "on"
57EndSection
58EOF
59
60doas mkdir -p /etc/X11/xorg.conf.d
61doas mv "$tmp_xorg_file" /etc/X11/xorg.conf.d/40-libinput.conf
62
63tmp_doas_file=$(mktemp)
64cp /etc/doas.d/20-wheel.conf "$tmp_doas_file"
65for c in poweroff reboot; do
66 printf 'permit nopass :wheel as root cmd %s\n' "$c" >> "$tmp_doas_file"
67done
68doas cp "$tmp_doas_file" /etc/doas.d/20-wheel.conf
69
70
71print_log "Configuring the console"
72
73tmp_kmap_file=$(mktemp)
74tmp_loadkmap_file=$(mktemp)
75printf 'keycode 1 = Caps_Lock\nkeycode 58 = Escape\n' > "$tmp_kmap_file"
76doas loadkeys "$tmp_kmap_file"
77dumpkmap > us-swapesc.bmap
78gzip us-swapesc.bmap
79doas mv us-swapesc.bmap.gz /etc/keymap/
80printf 'KEYMAP=/etc/keymap/us-swapesc.bmap.gz\n' > "$tmp_loadkmap_file"
81doas mv "$tmp_loadkmap_file" /etc/conf.d/loadkmap
82
83tmp_blacklist_file=$(mktemp)
84cp /etc/modprobe.d/blacklist.conf "$tmp_blacklist_file"
85printf '\n# Disable PC speaker for real\nblacklist pcspkr\n' >> "$tmp_blacklist_file"
86doas cp "$tmp_blacklist_file" /etc/modprobe.d/blacklist.conf
87
88
89print_log "Setting up ACPI (see https://wiki.alpinelinux.org/wiki/Power_management)"
90
91tmp_acpi_file=$(mktemp)
92printf '#!/bin/sh\necho mem > /sys/power/state\n' > "$tmp_acpi_file"
93
94for dir in LID PWRF; do
95 doas mkdir -p /etc/acpi/$dir
96 doas cp "$tmp_acpi_file" /etc/acpi/$dir/00000080
97 doas chmod +x /etc/acpi/$dir/00000080
98done
99
100doas rc-update add acpid
101
102
103print_log "Setting up WiFi (iwd) (see https://wiki.alpinelinux.org/wiki/Iwd)"
104
105tmp_iwd_file=$(mktemp)
106cat <<EOF > "$tmp_iwd_file"
107[General]
108EnableNetworkConfiguration=True
109
110[Network]
111NameResolvingService=resolvconf
112EOF
113
114doas mv "$tmp_iwd_file" /etc/iwd/main.conf
115
116doas rc-update add iwd boot
117doas rc-update del networking boot
118doas rc-service --ifstarted wpa_supplicant stop
119doas rc-service iwd start
120
121
122print_log "Setting up bluetooth (see https://wiki.alpinelinux.org/wiki/Bluetooth)"
123
124doas modprobe btusb
125doas adduser sebastiano lp
126doas rc-update add bluetooth
127doas rc-service bluetooth start
128
129
130print_log "Setting up SyncThing"
131
132tmp_syncthing_file=$(mktemp)
133doas print 'SYNCTHING_USER="sebastiano"\n' > "$tmp_syncthing_file"
134mv "$tmp_syncthing_file" /etc/conf.d/syncthing
135doas rc-update add syncthing
136doas rc-service start syncthing
137
138
139print_log "Generating SSH keys"
140
141ssh-keygen
142
143
144echo ""
145echo "All done!"
146echo ""
147echo "You should log out and back in to apply some of the changes."
148echo "Additionally, you may want to perform the following manual steps:"
149echo " 1. Connect to WiFi again. The default network manager has been"
150echo " replaced by iwd."
151echo " 2. Add your SSH key to various servers, namely:"
152echo " 1a. Artemisia"
153echo " 1b. pizoc (both regular user and git)"
154echo " 1c. github"
155echo " 1d. lampone"
156echo " 3. Share folders in SyncThing, including but not limited to:"
157echo " 2a. box with Artemisia, pizoc and phone"
158echo " 2b. file-drop with phone"
159echo " 4. Copy your mailbox.org password to .ssh/mailbox.org."
160echo " 5. Log into Firefox account and set up extensions, if needed."
161echo ""
162echo "Enjoy!"

Generated with cgit - Back to sebastiano.tronto.net