summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xscripts/apkworld11
-rwxr-xr-xscripts/setup-config-alpine135
2 files changed, 142 insertions, 4 deletions
diff --git a/scripts/apkworld b/scripts/apkworld
index 8200983..91deb8e 100755
--- a/scripts/apkworld
+++ b/scripts/apkworld
@@ -3,10 +3,13 @@
3# Install and remove packages from a configuration file. 3# Install and remove packages from a configuration file.
4 4
5# Usage: apkworld [file] 5# Usage: apkworld [file]
6# Requires: apk (Alpine Linux package manager) 6# Requires: apk (Alpine Linux package manager), doas (or sudo)
7 7
8PACKAGES="${1:-$HOME/.config/alpine-packages}" 8PACKAGES="${1:-$HOME/.config/alpine-packages}"
9SUDO_CMD=doas
9 10
10cp /etc/apk/world /etc/apk/world.backup 11tmp_file=$(mktemp)
11cat "$PACKAGES" | sed 's/#.*//' | grep -v '^[:space:]*$' > /etc/apk/world 12doas cp /etc/apk/world /etc/apk/world.backup
12apk fix 13cat "$PACKAGES" | sed 's/#.*//' | grep -v '^[:space:]*$' > $tmp_file
14doas mv $tmp_file /etc/apk/world
15doas apk fix
diff --git a/scripts/setup-config-alpine b/scripts/setup-config-alpine
new file mode 100755
index 0000000..a9a63b9
--- /dev/null
+++ b/scripts/setup-config-alpine
@@ -0,0 +1,135 @@
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
45done
46cd
47
48
49print_log "Swapping Escape and Caps Lock in console"
50
51tmp_kmap_file=$(mktemp)
52tmp_loadkmap_file=$(mktemp)
53printf 'keycode 1 = Caps_Lock\nkeycode 58 = Escape\n' > $tmp_kmap_file
54doas loadkeys $tmp_kmap_file
55dumpkmap > us-swapesc.bmap
56gzip us-swapesc.bmap
57doas mv us-swapesc.bmap.gz /etc/keymap/
58printf 'KEYMAP=/etc/keymap/us-swapesc.bmap.gz\n' > $tmp_loadkmap_file
59doas mv $tmp_loadkmap_file /etc/conf.d/loadkmap
60
61
62print_log "Setting up ACPI (see https://wiki.alpinelinux.org/wiki/Power_management)"
63
64tmp_acpi_file=$(mktemp)
65cat <<EOF > $tmp_acpi_file
66xhci="$(grep XHCI /proc/acpi/wakeup | awk '{print $3}')"
67[ "$xhci" == '*enabled' ] && echo XHCI > /proc/acpi/wakeup
68echo mem > /sys/power/state
69EOF
70
71for dir in LID PWRF; do
72 doas mkdir -p /etc/acpi/$dir
73 doas cp $tmp_acpi_file /etc/acpi/$dir/00000080
74 doas chmod +x /etc/acpi/$dir/00000080
75done
76
77
78print_log "Setting up WiFi (iwd) (see https://wiki.alpinelinux.org/wiki/Iwd)"
79
80tmp_iwd_file=$(mktemp)
81cat <<EOF > $tmp_iwd_file
82[General]
83EnableNetworkConfiguration=True
84
85[Network]
86NameResolvingService=resolvconf
87EOF
88
89doas mv $tmp_iwd_file /etc/iwd/main.conf
90
91doas rc-update add iwd boot
92doas rc-update del networking boot
93doas rc-service --ifstarted wpa_supplicant stop
94doas rc-service iwd start
95
96
97print_log "Setting up bluetooth (see https://wiki.alpinelinux.org/wiki/Bluetooth)"
98
99doas modprobe btusb
100doas adduser sebastiano lp
101doas rc-update add bluetooth
102doas rc-service bluetooth start
103
104
105print_log "Setting up SyncThing"
106
107tmp_syncthing_file=$(mktemp)
108doas print 'SYNCTHING_USER="sebastiano"\n' > $tmp_syncthing_file
109mv $tmp_syncthing_file /etc/conf.d/syncthing
110doas rc-update add syncthing
111doas rc-service start syncthing
112
113
114print_log "Generating SSH keys"
115
116ssh-keygen
117
118
119echo ""
120echo "All done!"
121echo ""
122echo "You should log out and back in to apply some of the changes."
123echo "Additionally, you may want to perform the following manual steps:"
124echo " 1. Connect to WiFi again. The default network manager has been"
125echo " replaced by iwd."
126echo " 2. Add your SSH key to various servers, namely:"
127echo " 1a. Artemisia"
128echo " 1b. pizoc (both regular user and git)"
129echo " 1c. github"
130echo " 3. Share folders in SyncThing, including but not limited to:"
131echo " 2a. box with Artemisia, pizoc and phone"
132echo " 2b. file-drop with phone"
133echo " 4. Copy your mailbox.org password to .ssh/mailbox.org"
134echo ""
135echo "Enjoy!"

Generated with cgit - Back to sebastiano.tronto.net