From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 30 Oct 2024 21:29:37 +0000 (+0100)
Subject: Various improvements to Raspi setup.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/static/%7Broute%7D?a=commitdiff_plain;h=8f9f988598a6ca1ec1f6bb334cd1a66c2cab31b5;p=config

Various improvements to Raspi setup.
---

diff --git a/many_releases/aptmark/raspi b/many_releases/aptmark/raspi
index 79eb683..c8b8c57 100644
--- a/many_releases/aptmark/raspi
+++ b/many_releases/aptmark/raspi
@@ -5,11 +5,13 @@ raspi-firmware
 # to boot into a graphical environment
 greetd
 sway
+# for sound
+pulseaudio
+# for setting console keyboard via /etc/default/keyboard 
+console-setup
 # for convenience
 sudo
 vim
 ack
 foot
 mpv
-# for sound
-pulseaudio
diff --git a/many_releases/etc/raspi/greetd/config.toml b/many_releases/etc/raspi/greetd/config.toml
index afbef59..d07e7c9 100644
--- a/many_releases/etc/raspi/greetd/config.toml
+++ b/many_releases/etc/raspi/greetd/config.toml
@@ -1,5 +1,5 @@
 [terminal]
 vt = 7 
 [default_session]
-command = "/home/plom/startup.sh"
+command = "/home/plom/.on_session_start.sh"
 user = "plom"
diff --git a/many_releases/home/raspi/.on_session_start.sh b/many_releases/home/raspi/.on_session_start.sh
new file mode 100755
index 0000000..bcbba4d
--- /dev/null
+++ b/many_releases/home/raspi/.on_session_start.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/sh
+# Iinitalize anything we want in our sessions opened by greetd.
+
+# Workaround to pulseaudio daemon somehow not respecting setting these with
+# ~/.config/pulse/default.pa – note that the first pactl call also seems
+# necessary, probably for forcing some init routines without which the pacmd
+# calls that follow won't work; TODO: find cleaner solutions 
+pactl list sinks > /dev/null
+pacmd set-default-sink alsa_output.platform-fef05700.hdmi.hdmi-stereo
+pacmd set-sink-volume alsa_output.platform-fef05700.hdmi.hdmi-stereo 32768 
+
+# Wayland environment.
+/usr/bin/sway
diff --git a/many_releases/home/raspi/.profile b/many_releases/home/raspi/.profile
new file mode 100644
index 0000000..d8c6f59
--- /dev/null
+++ b/many_releases/home/raspi/.profile
@@ -0,0 +1,10 @@
+# ~/.profile: executed by the command interpreter for login shells.
+
+# simplified defaults: read .bashrc, extend PATH by bin dirs
+. "$HOME/.bashrc"
+PATH="$HOME/.local/bin:$HOME/bin:$PATH"
+
+# to forward video on commands run via SSH login to screen we expect connected 
+if [ -n "$SSH_CONNECTION" ]; then
+  export WAYLAND_DISPLAY=wayland-1 
+fi
diff --git a/many_releases/home/raspi/profile b/many_releases/home/raspi/profile
deleted file mode 100644
index d8c6f59..0000000
--- a/many_releases/home/raspi/profile
+++ /dev/null
@@ -1,10 +0,0 @@
-# ~/.profile: executed by the command interpreter for login shells.
-
-# simplified defaults: read .bashrc, extend PATH by bin dirs
-. "$HOME/.bashrc"
-PATH="$HOME/.local/bin:$HOME/bin:$PATH"
-
-# to forward video on commands run via SSH login to screen we expect connected 
-if [ -n "$SSH_CONNECTION" ]; then
-  export WAYLAND_DISPLAY=wayland-1 
-fi
diff --git a/many_releases/home/raspi/startup.sh b/many_releases/home/raspi/startup.sh
deleted file mode 100755
index bcbba4d..0000000
--- a/many_releases/home/raspi/startup.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/sh
-# Iinitalize anything we want in our sessions opened by greetd.
-
-# Workaround to pulseaudio daemon somehow not respecting setting these with
-# ~/.config/pulse/default.pa – note that the first pactl call also seems
-# necessary, probably for forcing some init routines without which the pacmd
-# calls that follow won't work; TODO: find cleaner solutions 
-pactl list sinks > /dev/null
-pacmd set-default-sink alsa_output.platform-fef05700.hdmi.hdmi-stereo
-pacmd set-sink-volume alsa_output.platform-fef05700.hdmi.hdmi-stereo 32768 
-
-# Wayland environment.
-/usr/bin/sway
diff --git a/many_releases/home/user/.config/sway/config b/many_releases/home/user/.config/sway/config
index d0981b3..ccd2b50 100644
--- a/many_releases/home/user/.config/sway/config
+++ b/many_releases/home/user/.config/sway/config
@@ -1,3 +1,4 @@
 include /etc/sway/config
 output * background #551199 solid_color
 bindsym $mod+Shift+p exec swaynag -t warning -m 'Really exit sway/end Wayland session?' -B 'Yes, exit sway' 'swaymsg exit'
+input * xkb_layout "de"
diff --git a/testing/scripts/setup_raspi.sh b/testing/scripts/setup_raspi.sh
index 0d21b1b..791bf51 100755
--- a/testing/scripts/setup_raspi.sh
+++ b/testing/scripts/setup_raspi.sh
@@ -17,9 +17,16 @@ rm "${FILENAME_PUBLIC_KEY}"
 
 upgrade_from_older_release
 
-# properly configure and apt system
+# on installing console-setup, will guide it to do the right thing (including
+# re-writing /etc/default/keyboard) 
+echo 'XKBLAYOUT=de' > /etc/default/keyboard
+
+# properly configure apt and reduce system to minimum that satisfies our own
+# aptmark/ package lists
 for root in "${PATH_MANY}" '..'; do
-    copy_dirtree "${root}${PATH_REL_ETC}" '/etc' all raspi
+    # copy_dirtree "${root}${PATH_REL_ETC}" '/etc' all raspi
+    copy_dirtree "${root}${PATH_REL_ETC}/all" '/etc/apt' apt
+    copy_dirtree "${root}${PATH_REL_ETC}/raspi" '/etc/apt' apt
 done
 apt update
 mark_nonrequireds_auto
@@ -27,8 +34,6 @@ for root in "${PATH_MANY}" '..'; do
     install_for_modules "${root}${PATH_REL_APTMARK}" all raspi
 done
 apt -y --purge autoremove
-
-# just in case anything got overwritten … 
 for root in "${PATH_MANY}" '..'; do
     copy_dirtree "${root}${PATH_REL_ETC}" '/etc' all raspi
 done