diff options
| -rwxr-xr-x | .config/alpine-packages | 5 | ||||
| -rwxr-xr-x | scripts/apkworld | 11 | ||||
| -rwxr-xr-x | scripts/setup-config-alpine | 135 |
3 files changed, 145 insertions, 6 deletions
diff --git a/.config/alpine-packages b/.config/alpine-packages index bc67a6e..946a038 100755 --- a/.config/alpine-packages +++ b/.config/alpine-packages | |||
| @@ -24,14 +24,15 @@ build-base git gdb valgrind clang20 python3 rust cargo hare | |||
| 24 | lowdown darkhttpd # Both used for updating my website | 24 | lowdown darkhttpd # Both used for updating my website |
| 25 | libx11-dev libxft-dev libxinerama-dev | 25 | libx11-dev libxft-dev libxinerama-dev |
| 26 | 26 | ||
| 27 | # Xorg xorg-server | 27 | # Xorg |
| 28 | xorg-server | ||
| 28 | xinit eudev mesa-dri-gallium xf86-video-intel xf86-input-libinput xf86-input-synaptics | 29 | xinit eudev mesa-dri-gallium xf86-video-intel xf86-input-libinput xf86-input-synaptics |
| 29 | setxkbmap xsel xbanish xsetroot xwallpaper xev slock | 30 | setxkbmap xsel xbanish xsetroot xwallpaper xev slock |
| 30 | 31 | ||
| 31 | # X applications | 32 | # X applications |
| 32 | firefox libreoffice telegram-desktop vlc imv-x11 | 33 | firefox libreoffice telegram-desktop vlc imv-x11 |
| 33 | zathura-djvu zathura-pdf-mupdf zathura-ps | 34 | zathura-djvu zathura-pdf-mupdf zathura-ps |
| 34 | arandr | 35 | arandr iwgtk |
| 35 | 36 | ||
| 36 | # Fonts, but like a gazillion of them | 37 | # Fonts, but like a gazillion of them |
| 37 | font-terminus font-noto font-noto-extra font-arabic-misc | 38 | font-terminus font-noto font-noto-extra font-arabic-misc |
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 | ||
| 8 | PACKAGES="${1:-$HOME/.config/alpine-packages}" | 8 | PACKAGES="${1:-$HOME/.config/alpine-packages}" |
| 9 | SUDO_CMD=doas | ||
| 9 | 10 | ||
| 10 | cp /etc/apk/world /etc/apk/world.backup | 11 | tmp_file=$(mktemp) |
| 11 | cat "$PACKAGES" | sed 's/#.*//' | grep -v '^[:space:]*$' > /etc/apk/world | 12 | doas cp /etc/apk/world /etc/apk/world.backup |
| 12 | apk fix | 13 | cat "$PACKAGES" | sed 's/#.*//' | grep -v '^[:space:]*$' > $tmp_file |
| 14 | doas mv $tmp_file /etc/apk/world | ||
| 15 | doas 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 | |||
| 5 | print_log() { | ||
| 6 | printf '\n>>> %s \n\n' "$@" | ||
| 7 | } | ||
| 8 | |||
| 9 | set -e # Abort on first error | ||
| 10 | |||
| 11 | |||
| 12 | print_log "Installing git and cloning the config repo" | ||
| 13 | |||
| 14 | doas apk add git | ||
| 15 | cd ~ | ||
| 16 | git init . | ||
| 17 | git remote add origin https://git.tronto.net/config | ||
| 18 | git fetch && git checkout -f master | ||
| 19 | git remote set-url origin git@tronto.net:config | ||
| 20 | git remote set-url origin --add --push git@github.com:sebastianotronto/config | ||
| 21 | |||
| 22 | |||
| 23 | print_log "Installing software from alpine repositories" | ||
| 24 | |||
| 25 | tmp_repo_file=$(mktemp) | ||
| 26 | main_repo="$(grep main /etc/apk/repositories)" | ||
| 27 | community_repo="$(echo "$main_repo" | sed 's/main/community/')" | ||
| 28 | printf '%s\n%s\n' "$main_repo" "$community_repo" > $tmp_repo_file | ||
| 29 | doas mv $tmp_repo_file /etc/apk/repositories | ||
| 30 | |||
| 31 | ./scripts/apkworld | ||
| 32 | |||
| 33 | |||
| 34 | print_log "Installing and configuring desktop environment" | ||
| 35 | |||
| 36 | doas setup-xorg-base | ||
| 37 | |||
| 38 | mkdir -p src | ||
| 39 | cd src | ||
| 40 | for 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 | done | ||
| 46 | cd | ||
| 47 | |||
| 48 | |||
| 49 | print_log "Swapping Escape and Caps Lock in console" | ||
| 50 | |||
| 51 | tmp_kmap_file=$(mktemp) | ||
| 52 | tmp_loadkmap_file=$(mktemp) | ||
| 53 | printf 'keycode 1 = Caps_Lock\nkeycode 58 = Escape\n' > $tmp_kmap_file | ||
| 54 | doas loadkeys $tmp_kmap_file | ||
| 55 | dumpkmap > us-swapesc.bmap | ||
| 56 | gzip us-swapesc.bmap | ||
| 57 | doas mv us-swapesc.bmap.gz /etc/keymap/ | ||
| 58 | printf 'KEYMAP=/etc/keymap/us-swapesc.bmap.gz\n' > $tmp_loadkmap_file | ||
| 59 | doas mv $tmp_loadkmap_file /etc/conf.d/loadkmap | ||
| 60 | |||
| 61 | |||
| 62 | print_log "Setting up ACPI (see https://wiki.alpinelinux.org/wiki/Power_management)" | ||
| 63 | |||
| 64 | tmp_acpi_file=$(mktemp) | ||
| 65 | cat <<EOF > $tmp_acpi_file | ||
| 66 | xhci="$(grep XHCI /proc/acpi/wakeup | awk '{print $3}')" | ||
| 67 | [ "$xhci" == '*enabled' ] && echo XHCI > /proc/acpi/wakeup | ||
| 68 | echo mem > /sys/power/state | ||
| 69 | EOF | ||
| 70 | |||
| 71 | for 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 | ||
| 75 | done | ||
| 76 | |||
| 77 | |||
| 78 | print_log "Setting up WiFi (iwd) (see https://wiki.alpinelinux.org/wiki/Iwd)" | ||
| 79 | |||
| 80 | tmp_iwd_file=$(mktemp) | ||
| 81 | cat <<EOF > $tmp_iwd_file | ||
| 82 | [General] | ||
| 83 | EnableNetworkConfiguration=True | ||
| 84 | |||
| 85 | [Network] | ||
| 86 | NameResolvingService=resolvconf | ||
| 87 | EOF | ||
| 88 | |||
| 89 | doas mv $tmp_iwd_file /etc/iwd/main.conf | ||
| 90 | |||
| 91 | doas rc-update add iwd boot | ||
| 92 | doas rc-update del networking boot | ||
| 93 | doas rc-service --ifstarted wpa_supplicant stop | ||
| 94 | doas rc-service iwd start | ||
| 95 | |||
| 96 | |||
| 97 | print_log "Setting up bluetooth (see https://wiki.alpinelinux.org/wiki/Bluetooth)" | ||
| 98 | |||
| 99 | doas modprobe btusb | ||
| 100 | doas adduser sebastiano lp | ||
| 101 | doas rc-update add bluetooth | ||
| 102 | doas rc-service bluetooth start | ||
| 103 | |||
| 104 | |||
| 105 | print_log "Setting up SyncThing" | ||
| 106 | |||
| 107 | tmp_syncthing_file=$(mktemp) | ||
| 108 | doas print 'SYNCTHING_USER="sebastiano"\n' > $tmp_syncthing_file | ||
| 109 | mv $tmp_syncthing_file /etc/conf.d/syncthing | ||
| 110 | doas rc-update add syncthing | ||
| 111 | doas rc-service start syncthing | ||
| 112 | |||
| 113 | |||
| 114 | print_log "Generating SSH keys" | ||
| 115 | |||
| 116 | ssh-keygen | ||
| 117 | |||
| 118 | |||
| 119 | echo "" | ||
| 120 | echo "All done!" | ||
| 121 | echo "" | ||
| 122 | echo "You should log out and back in to apply some of the changes." | ||
| 123 | echo "Additionally, you may want to perform the following manual steps:" | ||
| 124 | echo " 1. Connect to WiFi again. The default network manager has been" | ||
| 125 | echo " replaced by iwd." | ||
| 126 | echo " 2. Add your SSH key to various servers, namely:" | ||
| 127 | echo " 1a. Artemisia" | ||
| 128 | echo " 1b. pizoc (both regular user and git)" | ||
| 129 | echo " 1c. github" | ||
| 130 | echo " 3. Share folders in SyncThing, including but not limited to:" | ||
| 131 | echo " 2a. box with Artemisia, pizoc and phone" | ||
| 132 | echo " 2b. file-drop with phone" | ||
| 133 | echo " 4. Copy your mailbox.org password to .ssh/mailbox.org" | ||
| 134 | echo "" | ||
| 135 | echo "Enjoy!" | ||
