aboutsummaryrefslogtreecommitdiff
path: root/home/dot_config/yadm/root/executable_bootstrap
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2026-08-02 14:48:29 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2026-08-02 14:48:29 +0200
commite43eb1177872f52e949fb5f0f93396ed94b0d093 (patch)
tree78b73af6a989fa2996d71b112e161b70d35081ef /home/dot_config/yadm/root/executable_bootstrap
parent2f14a896e4b897bd747c24d7ad8e9e7bb3237d03 (diff)
move to chezmoi
Diffstat (limited to 'home/dot_config/yadm/root/executable_bootstrap')
-rw-r--r--home/dot_config/yadm/root/executable_bootstrap95
1 files changed, 95 insertions, 0 deletions
diff --git a/home/dot_config/yadm/root/executable_bootstrap b/home/dot_config/yadm/root/executable_bootstrap
new file mode 100644
index 0000000..f8b59fb
--- /dev/null
+++ b/home/dot_config/yadm/root/executable_bootstrap
@@ -0,0 +1,95 @@
+#!/bin/sh
+cd "$(dirname "$0")"
+. ../lib/bootstrap
+
+# never use custom locale in TTY/logs
+export LANG=C
+
+alias s=silent
+
+
+wrong_call() {
+ cat << EOF
+run this script as root and with the username of your user account
+
+examples:
+ $ sudo $0 loek
+
+ $ sudo $0 "\$LOGNAME"
+
+ # $0 gert
+EOF
+ exit 1
+}
+
+# this script needs to run with root privileges
+[ $(id -u) -ne 0 ] && wrong_call
+# SETUP_USER must exist
+SETUP_USER="$1"
+s getent passwd "$SETUP_USER" || wrong_call
+# SETUP_USER can not be root
+[ $(id -u "$SETUP_USER") -eq 0 ] && wrong_call
+
+begintask "copy system config files"
+s cp -r --preserve=mode,timestamps etc/. /etc
+endtask
+
+PINENTRY="pinentry-gnome3"
+[ "$(command -v pinentry | xargs realpath | xargs basename)" != "$PINENTRY" ] && (
+ begintask "set pinentry program to $PINENTRY"
+ s ln -sf "$PINENTRY" "$(command -v pinentry)"
+ endtask
+)
+
+begintask "enabling services"
+s systemctl enable bluetooth ntpd cups
+endtask
+
+GROUPS_OK=1
+CURRENT_GROUPS="$(id -Gn "$SETUP_USER")"
+TARGET_GROUPS="users uucp optical lp audio wheel input"
+for group in $TARGET_GROUPS ; do
+ if ! echo "$CURRENT_GROUPS" | s grep "$group" ; then
+ GROUPS_OK=0
+ break
+ fi
+done
+[ "$GROUPS_OK" -ne 1 ] && (
+ begintask "adding $SETUP_USER to groups"
+ s usermod -aG "$(echo "$TARGET_GROUPS" | tr ' ' ',')" "$SETUP_USER"
+ endtask
+)
+
+PAM_GNUPG_FILE="/etc/pam.d/system-login"
+! s grep 'pam_gnupg' "$PAM_GNUPG_FILE" && (
+ begintask "adding pam-gnupg PAM module"
+ cat << EOF >> "$PAM_GNUPG_FILE"
+
+# https://github.com/cruegge/pam-gnupg
+auth optional pam_gnupg.so store-only
+session optional pam_gnupg.so
+EOF
+ endtask
+)
+
+s grep '^#\s*\<Color\>' /etc/pacman.conf && (
+ begintask "enabling color in /etc/pacman.conf"
+ s sed 's/^#\s*\(\<Color\>\)/\1/g' -i /etc/pacman.conf
+ endtask
+)
+
+begintask "set autorandr to run at lightdm display startup"
+s augtool set '/files/etc/lightdm/lightdm.conf/Seat:*/display-setup-script' '/etc/lightdm/autorandr-change'
+endtask
+
+[ "$(getent passwd "$SETUP_USER" | cut -d: -f7 | xargs basename)" != "zsh" ] && (
+ begintask "set user shell to zsh"
+ s chsh -s "$(command -v zsh)" "$SETUP_USER"
+ endtask
+)
+
+cat << EOF
+
+root bootstrap finished in $(finishtime)!
+
+EOF