From 95a3dd4ea9de431aff34a316ca049c5f01685082 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Sun, 17 Dec 2023 23:47:10 +0100
Subject: [PATCH] Update bookworm setup to accommodate h610m.

---
 bookworm/apt-mark/thinkpad              |  9 ++++++++
 bookworm/apt-mark/user                  | 10 ---------
 bookworm/setup_scripts/misc.sh          |  2 +-
 bookworm/setup_scripts/setup_desktop.sh | 29 +++++++++++++++----------
 bookworm/setup_scripts/setup_firefox.sh |  2 +-
 5 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/bookworm/apt-mark/thinkpad b/bookworm/apt-mark/thinkpad
index 9e9f2e3..fa7bd38 100644
--- a/bookworm/apt-mark/thinkpad
+++ b/bookworm/apt-mark/thinkpad
@@ -1,7 +1,16 @@
 # for wifi
 firmware-iwlwifi
+network-manager
+wpasupplicant
 # for tlp
 tlp
 tp-smapi-dkms
+# for X to start at all
+xserver-xorg-video-intel
+# X input: keyboard and touchpad
+xserver-xorg-input-evdev
+xserver-xorg-input-synaptics
+# to use printer
+cups
 #
 
diff --git a/bookworm/apt-mark/user b/bookworm/apt-mark/user
index 0b23a3b..dac354a 100644
--- a/bookworm/apt-mark/user
+++ b/bookworm/apt-mark/user
@@ -1,16 +1,8 @@
 # to avoid booting problems with encrypted LVM, see <https://askubuntu.com/a/1105848>
 cryptsetup-initramfs
 lvm2
-# for wifi
-network-manager
-wpasupplicant
 # this provides setupcon which reads /etc/default/console-setup
 console-setup
-# for X to start at all
-xserver-xorg-video-intel
-# X input: keyboard and touchpad
-xserver-xorg-input-evdev
-xserver-xorg-input-synaptics
 # for startx
 xinit
 # for xrdb
@@ -41,8 +33,6 @@ libgtk-3-0
 libdbus-glib-1-2
 # for firefox to emit sound
 pulseaudio
-# to use printer
-cups
 # emacs
 emacs
 emacs-common-non-dfsg
diff --git a/bookworm/setup_scripts/misc.sh b/bookworm/setup_scripts/misc.sh
index 641d752..4aad4a4 100644
--- a/bookworm/setup_scripts/misc.sh
+++ b/bookworm/setup_scripts/misc.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 set -e
 debian_version="bookworm"
-legal_system_names="x220 w530"
+legal_system_names="x220 w530 h610m"
 config_tree_prefix="${HOME}/public_repos/config/${debian_version}"
 if [ ! -d "${config_tree_prefix}" ]; then
     config_tree_prefix="${HOME}/config/${debian_version}"
diff --git a/bookworm/setup_scripts/setup_desktop.sh b/bookworm/setup_scripts/setup_desktop.sh
index 637dfc2..a617e0e 100755
--- a/bookworm/setup_scripts/setup_desktop.sh
+++ b/bookworm/setup_scripts/setup_desktop.sh
@@ -7,18 +7,22 @@ get_system_name_arg "$1"
 
 # Set up system without user environment.
 cd "${setup_scripts_dir}"
-./_setup.sh "${system_name}" "" user desktop thinkpad "${system_name}"
+if [ "$system_name" = "w530" || "$system_name" = "x220"]; then
+    ./_setup.sh "${system_name}" "" user desktop thinkpad "${system_name}"
+else
+    ./_setup.sh "${system_name}" "" user desktop "${system_name}"
+fi
 
-# Set up printer.
-ppd_deb="hll2350dwpdrv-4.0.0-1.i386.deb"
-wget "https://download.brother.com/welcome/dlf103566/${ppd_deb}"
-dpkg --add-architecture i386
-apt update
-apt install -y "./${ppd_deb}"
-service cups restart
-# lpadmin -p 'Brother_HLL2350DW' -m 'brother-HLL2350DW-cups-en.ppd'
-rm "./${ppd_deb}"
-# TODO explore potential lpadmin options like -o 'OutputMode=NormalGray'
+# # Set up printer.
+# ppd_deb="hll2350dwpdrv-4.0.0-1.i386.deb"
+# wget "https://download.brother.com/welcome/dlf103566/${ppd_deb}"
+# dpkg --add-architecture i386
+# apt update
+# apt install -y "./${ppd_deb}"
+# service cups restart
+# # lpadmin -p 'Brother_HLL2350DW' -m 'brother-HLL2350DW-cups-en.ppd'
+# rm "./${ppd_deb}"
+# # TODO explore potential lpadmin options like -o 'OutputMode=NormalGray'
 
 # Set up NVIDIA eGPU config.
 if [ "$system_name" = "w530" ]; then
@@ -26,16 +30,19 @@ if [ "$system_name" = "w530" ]; then
     git clone https://github.com/NVIDIA/open-gpu-kernel-modules
     cd open-gpu-kernel-modules
     git checkout 337e28e
+    # git checkout 4c29105335610933e744f4ab2524ea63fc39edaf
     make modules -j$(nproc)
     make modules_install
     cd
     driver_version=535.86.05
+    # driver_version=545.29.06
     runscript=NVIDIA-Linux-x86_64-${driver_version}.run
     wget https://us.download.nvidia.com/XFree86/Linux-x86_64/${driver_version}/${runscript}
     rmmod nouveau
     chmod u+x ${runscript} 
     ./${runscript} --no-kernel-modules --silent
     depmod
+    # TODO I suspect that the GPU falling of the bus may be mildened by running nvidia-persistenced, check https://github.com/NVIDIA/nvidia-persistenced/tree/main/init  
 fi
 
 # Set up user environments.
diff --git a/bookworm/setup_scripts/setup_firefox.sh b/bookworm/setup_scripts/setup_firefox.sh
index f3f1f7c..a3c8f6c 100755
--- a/bookworm/setup_scripts/setup_firefox.sh
+++ b/bookworm/setup_scripts/setup_firefox.sh
@@ -3,7 +3,7 @@ set -e
 . ./misc.sh
 
 # Install Firefox directly from Mozilla.
-firefox_release="115.4.0esr"
+firefox_release="115.5.0esr"
 firefox_filename="firefox-${firefox_release}.tar.bz2"
 url_firefox="https://ftp.mozilla.org/pub/firefox/releases/${firefox_release}/linux-x86_64/en-US/${firefox_filename}"
 wget "${url_firefox}"
-- 
2.30.2