From aa8f38c6c3ee20e0e45bf481d3da70fb67e1d69a Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 29 Oct 2024 05:13:44 +0100
Subject: [PATCH] Improve Raspi setup.

---
 many_releases/aptmark/raspi                       |  3 +++
 many_releases/home/raspi/.config/mpv/mpv.conf     |  1 +
 many_releases/home/raspi/.config/pulse/default.pa |  3 +++
 testing/scripts/setup_raspi.sh                    | 14 ++++++--------
 4 files changed, 13 insertions(+), 8 deletions(-)
 create mode 100644 many_releases/home/raspi/.config/mpv/mpv.conf
 create mode 100644 many_releases/home/raspi/.config/pulse/default.pa

diff --git a/many_releases/aptmark/raspi b/many_releases/aptmark/raspi
index b630ef2..79eb683 100644
--- a/many_releases/aptmark/raspi
+++ b/many_releases/aptmark/raspi
@@ -10,3 +10,6 @@ sudo
 vim
 ack
 foot
+mpv
+# for sound
+pulseaudio
diff --git a/many_releases/home/raspi/.config/mpv/mpv.conf b/many_releases/home/raspi/.config/mpv/mpv.conf
new file mode 100644
index 0000000..3c25dcd
--- /dev/null
+++ b/many_releases/home/raspi/.config/mpv/mpv.conf
@@ -0,0 +1 @@
+vo=gpu-next
diff --git a/many_releases/home/raspi/.config/pulse/default.pa b/many_releases/home/raspi/.config/pulse/default.pa
new file mode 100644
index 0000000..0b25b91
--- /dev/null
+++ b/many_releases/home/raspi/.config/pulse/default.pa
@@ -0,0 +1,3 @@
+.include /etc/pulse/default.pa
+set-default-sink alsa_output.platform-fef05700.hdmi.hdmi-stereo
+set-sink-volume @DEFAULT_SINK@ 50%
diff --git a/testing/scripts/setup_raspi.sh b/testing/scripts/setup_raspi.sh
index a4c2634..a4ff538 100755
--- a/testing/scripts/setup_raspi.sh
+++ b/testing/scripts/setup_raspi.sh
@@ -4,8 +4,6 @@ set -x
 . ../../constants.sh
 . "${PATH_MANY_MISC}"
 
-# ensure we got a proper IP address
-dhclient
 # ensure we can log in
 # (alternatively, or preceding this to reduce non-remote typing, TEMPORARILY
 # (!) set password login:)
@@ -41,6 +39,9 @@ locale-gen
 # Set Berlin localtime.
 ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
 
+# so Sway won't complain about failing to access non-existant background image file
+sed -i '/^output \* bg/ s/^/#/' /etc/sway/config
+
 # Set up users and their environments.
 for root in "${PATH_MANY}" '..'; do
     copy_dirtree "${root}${PATH_REL_HOME}" '/root' all root
@@ -48,14 +49,11 @@ done
 adduser --disabled-password --gecos "" "${USERNAME}" 
 usermod -a -G sudo "${USERNAME}" 
 for root in "${PATH_MANY}" '..'; do
-    copy_dirtree "${root}${PATH_REL_HOME}" "${PATH_USER_HOME}" all user 
+    copy_dirtree "${root}${PATH_REL_HOME}" "${PATH_USER_HOME}" all user raspi 
 done
 cp -a "${PATH_REPO}" "${PATH_USER_HOME}" 
 mkdir "${PATH_USER_SSH}"
 cp "${PATH_AUTHORIZED_KEYS}" "${PATH_USER_SSH}"
-chown -R "${PATH_USER_HOME}"
-passwd "${USERNAME}" 
+chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}"
+passwd "${USERNAME}"
 rm "${PATH_AUTHORIZED_KEYS}"
-
-# # let us boot into Sway
-# systemctl greetd enable
-- 
2.30.2