home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 00:01:48 +0000 (02:01 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 6 May 2025 00:01:48 +0000 (02:01 +0200)
trixie/scripts/from_older_upgrade.sh

index 6b3527932c0ea0ed3e0e12974e7927416b34793f..2256d35e885ffc3f75b956a0065011fa72d3730a 100755 (executable)
@@ -1,44 +1,59 @@
 #!/bin/sh
 set -e
 cd $(dirname "$0")
-. lib/apt_get_edited
+. lib/abort
+. lib/apt_get_digested
 . lib/constants_etc  # PATH_ETC
+. lib/constants_releases  # PREV_RELEASE, THIS_RELEASE
+. lib/expect_n_args
 . lib/minimize_installation
+. lib/prefixed_msg
 
-minimize_installation all_old server_basic_old
+prefixed_msg_init 'from_older_upgrade.sh'
+prefixed_msg "starting (upgrading from ${PREV_RELEASE} to ${THIS_RELEASE})"
 
-PATH_ETC_APT="${PATH_ETC}/apt"
-PATH_ETC_APT_CONF=${PATH_ETC_APT}/apt.conf.d
-PATH_COPY_TAG='../copy/all'
+MSG_ALLOWED_INSTALLATION_TYPES='either "server" or "desktop"'
+expect_n_args 1 1 "INSTALLATION_TYPE (${MSG_ALLOWED_INSTALLATION_TYPES})"
+if [ "$1" != 'server' -a "$1" != 'desktop' ]; then
+    abort "illegal argument, must be ${MSG_ALLOWED_INSTALLATION_TYPES}"
+fi
+prefixed_msg 'minimizing installation first so there is less to upgrade'
+INSTALL_TAGS='all minimal keep_if_installed:systemd_resolved'
+
+"../../${PREV_RELEASE}/minimize_installation" "${INSTALL_TAGS}"
 
 apt_update_to_full_upgrade() {
-    echo '# Updating package database …'
-    apt_get_edited '-q -q update'
-    echo '# Autopurge!'
-    apt_get_edited '-q -q autopurge'
-
-    echo '# Soft-upgrading …'
-    apt_get_edited '-q -q --purge -o Dpkg::Options::=--force-confnew upgrade'
-    echo '# Autopurge!'
-    apt_get_edited '-q -q autopurge'
-
-    echo '# Full-upgrading …'
-    apt_get_edited '-q -q --purge -o Dpkg::Options::=--force-confnew full-upgrade'
-    echo '# Autopurge!'
-    apt_get_edited '-q -q autopurge'
+    prefixed_msg 'Updating package database …'
+    apt_get_digested '-q -q update'
+    prefixed_msg 'Autopurge!'
+    apt_get_digested '-q -q autopurge'
+
+    prefixed_msg 'Soft-upgrading …'
+    apt_get_digested '-q -q --purge -o Dpkg::Options::=--force-confnew upgrade'
+    prefixed_msg 'Autopurge!'
+    apt_get_digested '-q -q autopurge'
+
+    prefixed_msg 'Full-upgrading …'
+    apt_get_digested '-q -q --purge -o Dpkg::Options::=--force-confnew full-upgrade'
+    prefxied_msg 'Autopurge!'
+    apt_get_digested '-q -q autopurge'
 }
+PATH_ETC_APT="${PATH_ETC}/apt"
+PATH_ETC_APT_CONF=${PATH_ETC_APT}/apt.conf.d
+PATH_COPY_TAG='../copy/all'
 
 PATH_CONF_MIN_DEPS="${PATH_COPY_TAG}${PATH_ETC_APT_CONF}/99_minimize_dependencies"
-echo "# Copying over ${PATH_CONF_MIN_DEPS} …"
+prefixed_msg "Copying over ${PATH_CONF_MIN_DEPS} …"
 cp "${PATH_CONF_MIN_DEPS}" "${PATH_ETC_APT_CONF}/"
-
 apt_update_to_full_upgrade
 
 PATH_CONF_SOURCES="${PATH_COPY_TAG}${PATH_ETC_APT}/sources.list"
-echo "# Copying over ${PATH_CONF_SOURCES} …"
+prefixed_msg "Copying over ${PATH_CONF_SOURCES} …"
 cp "${PATH_CONF_SOURCES}" "${PATH_ETC_APT}/"
-
 apt_update_to_full_upgrade
 
-echo '# Autopurge!'
-apt_get_edited  '-q -q autopurge'
+prefixed_msg 'Autopurge!'
+apt_get_digested  '-q -q autopurge'
+
+prefixed_msg 'finished'
+prefixed_msg_exit