From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 25 Feb 2025 07:29:29 +0000 (+0100)
Subject: Overhaul upgrading.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/booking/day_todos?a=commitdiff_plain;h=1df297f0a83d0fce2a45bc88cf1ce893cc19e561;p=config

Overhaul upgrading.
---

diff --git a/testing/scripts/setup_desktop.sh b/testing/scripts/setup_desktop.sh
index c017095..f909034 100755
--- a/testing/scripts/setup_desktop.sh
+++ b/testing/scripts/setup_desktop.sh
@@ -5,15 +5,21 @@ set -x
 
 expect_min_n_args 1 "(system name)" "$@"
 get_system_name_arg "$1"
-min_modules="all ${system_class_name} ${system_name}"
+MIN_MODULES="all ${system_class_name} ${system_name}"
 
-# Adapt /etc/ to our needs by copying from ./etc_files. This will set
-# basic configurations affecting following steps, such as setup of APT
-# and the locale selection, so needs to be right at the beginning.
-copy_dirtree "${config_tree_prefix}/${PATH_REL_ETC}" "" ${min_modules}
-
-# Migrate to testing.
-upgrade_from_older_release
+# For upgrading only very selectively prepare /etc/ files.
+PATH_REL_APT_CONF=apt/apt.conf
+PATH_REL_SOURCES_LIST=apt/sources.list
+cp ${PATH_MANY}/${PATH_REL_ETC}/all/${PATH_REL_APT_CONF}/* /${PATH_REL_ETC}/${PATH_REL_APT_CONF}/
+apt update
+apt -y -o Dpkg::Options::='--force-confnew' upgrade
+apt -y -o Dpkg::Options::='--force-confnew' full-upgrade
+cp ../${PATH_REL_ETC}/all/${PATH_REL_SOURCES_LIST}/* /${PATH_REL_ETC}/
+apt clean
+apt update
+apt -y -o Dpkg::Options::='--force-confnew' upgrade
+apt -y -o Dpkg::Options::='--force-confnew' full-upgrade
+apt -y autoremove
 
 # Set hostname and FQDN.
 echo "${system_name}" > /etc/hostname
@@ -51,11 +57,13 @@ if [ "$system_name" = "h610m" ]; then
     apt-mark hold linux-image-amd64 linux-headers-amd64
 fi
 for root in "${PATH_MANY}" '..'; do
-    install_for_modules "${root}/${PATH_REL_APTMARK}" ${min_modules}
+    install_for_modules "${root}/${PATH_REL_APTMARK}" ${MIN_MODULES}
 done
 apt -y --purge autoremove
+
+# Adapt /etc/ to our needs.
 for root in "${PATH_MANY}" '..'; do
-    copy_dirtree "${root}/${PATH_REL_ETC}" '/etc' ${min_modules}
+    copy_dirtree "${root}/${PATH_REL_ETC}" '/etc' ${MIN_MODULES}
 done
 
 # Ensure our desired locale is available.
@@ -67,14 +75,14 @@ ntpdate-debian
 
 # Set up root environment.
 for root in "${PATH_MANY}" '..'; do
-    copy_dirtree "${root}/${PATH_REL_HOME}" '/root' ${min_modules} minimal root
+    copy_dirtree "${root}/${PATH_REL_HOME}" '/root' ${MIN_MODULES} minimal root
 done
 
 # Set up user and their environment.
 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}" ${min_modules} desktop
+    copy_dirtree "${root}/${PATH_REL_HOME}" "${PATH_USER_HOME}" ${MIN_MODULES} desktop
 done
 chown -R "${USERNAME}:${USERNAME}" "${PATH_USER_HOME}"
 passwd "${USERNAME}"