From 8f9f988598a6ca1ec1f6bb334cd1a66c2cab31b5 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 30 Oct 2024 22:29:37 +0100
Subject: [PATCH] Various improvements to Raspi setup.

---
 many_releases/aptmark/raspi                         |  6 ++++--
 many_releases/etc/raspi/greetd/config.toml          |  2 +-
 .../home/raspi/{startup.sh => .on_session_start.sh} |  0
 many_releases/home/raspi/{profile => .profile}      |  0
 many_releases/home/user/.config/sway/config         |  1 +
 testing/scripts/setup_raspi.sh                      | 13 +++++++++----
 6 files changed, 15 insertions(+), 7 deletions(-)
 rename many_releases/home/raspi/{startup.sh => .on_session_start.sh} (100%)
 rename many_releases/home/raspi/{profile => .profile} (100%)

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/startup.sh b/many_releases/home/raspi/.on_session_start.sh
similarity index 100%
rename from many_releases/home/raspi/startup.sh
rename to many_releases/home/raspi/.on_session_start.sh
diff --git a/many_releases/home/raspi/profile b/many_releases/home/raspi/.profile
similarity index 100%
rename from many_releases/home/raspi/profile
rename to many_releases/home/raspi/.profile
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
-- 
2.30.2