home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 19 Aug 2025 18:22:59 +0000 (20:22 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 19 Aug 2025 18:22:59 +0000 (20:22 +0200)
trixie/scripts/lib/ensure_packages_of_tags.sh [changed from symlink to file mode: 0644]
trixie/scripts/minimize_installation.sh [changed from symlink to file mode: 0755]

deleted file mode 120000 (symlink)
index ca07505b3499c4f83adfab8ffa3c45bdd128f89c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../bookworm/scripts/lib/ensure_packages_of_tags.sh
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..c4495f6d0ca94f30042a8a3337ba2d68f9e7274e
--- /dev/null
@@ -0,0 +1,35 @@
+. lib/apt_digested.sh
+. lib/prefixed_msg.sh
+
+ensure_packages_of_tags() {
+prefixed_msg_init 'ensure_packages_of_tags'
+
+_APT_ARG="-q -q -o 'Dpkg::Options::=--force-confnew' install"
+for _TAG in $@; do
+    prefixed_msg_no_nl "For tag '${_TAG}', "
+    if [ "$(echo ${_TAG} | cut -d':' -f1)" = 'keep_if_installed' ]; then
+        _PACKAGE=$(echo ${_TAG} | cut -d':' -f2)
+        printf 'checking if installed … '
+        if dpkg-query -Wf '${Package}\n' | grep '^'"${_PACKAGE}"'$' > /dev/null; then
+            echo 'yup, keeping!'
+            apt_digested "${_APT_ARG} ${_PACKAGE}"
+        else
+            echo 'nope, nothing to keep.'
+        fi
+        continue
+    fi
+    _PATH_APTMARK_TAG="../aptmark/${_TAG}"
+    if [ ! -f "${_PATH_APTMARK_TAG}" ]; then
+        echo 'no file, ignoring.'
+        continue
+    fi
+    _PACKAGES=$(cat "${_PATH_APTMARK_TAG}" | sed -E 's/#.*//g' | sed -z 's/\n/ /g' | sed 's/  */ /g' | cut -c 2-)
+    if [ -z "${_PACKAGES}" ]; then
+        echo 'nothing to install.'
+    else
+        echo "ensuring installation of: ${_PACKAGES}"
+        apt_digested "${_APT_ARG} ${_PACKAGES}"
+    fi
+done
+prefixed_msg_exit
+}
deleted file mode 120000 (symlink)
index a9bd291f0c87186a7920a306baacd85dbffbd94c..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-../../bookworm/scripts/minimize_installation.sh
\ No newline at end of file
new file mode 100755 (executable)
index 0000000000000000000000000000000000000000..efe4fcd92800ffb4def57ec6a2d8a25ea83c486a
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+cd $(dirname "$0")
+. lib/apt_digested.sh
+. lib/ensure_packages_of_tags.sh
+. lib/prefixed_msg.sh
+
+prefixed_msg_init
+_INSTALL_TAGS="$@"
+prefixed_msg "narrow system to what is required explicitly by Debian and by us, as per these INSTALL_TAGS: ${_INSTALL_TAGS}"
+
+_TOK_REQ='required'
+_PATH_LIST_PREFIX=/tmp/list_
+_PATH_LIST_UNSORTED="${_PATH_LIST_PREFIX}unsorted"
+_PATH_LIST_WHITE="${_PATH_LIST_PREFIX}white"
+_PATH_LIST_ALL_PACKAGES="${_PATH_LIST_PREFIX}all_packages"
+_PATH_LIST_BLACK="${_PATH_LIST_PREFIX}black"
+
+prefixed_msg_no_nl "collect packages deemed '${_TOK_REQ}' by Debian: "
+dpkg-query -Wf '${Package} ${Priority}\n' | grep " ${_TOK_REQ}" | cut -d' ' -f1 > "${_PATH_LIST_UNSORTED}"
+sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_WHITE}"
+echo $(cat "${_PATH_LIST_WHITE}")
+
+prefixed_msg 'collect installed packages outside this selection …'
+dpkg-query -Wf '${Package}\n' > "${_PATH_LIST_UNSORTED}"
+sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_ALL_PACKAGES}"
+comm -3 "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" > "${_PATH_LIST_BLACK}"
+
+prefixed_msg 'apt-mark auto from diff …'
+apt-mark auto `cat "${_PATH_LIST_BLACK}"` > /dev/null
+rm "${_PATH_LIST_UNSORTED}" "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" "${_PATH_LIST_BLACK}"
+
+prefixed_msg 'install or mark as manually installed packages from our own selections …'
+ensure_packages_of_tags ${_INSTALL_TAGS}
+
+prefixed_msg 'run autopurge to get rid of all unwanted packages …'
+apt_digested '-q -q autopurge'
+
+prefixed_msg_exit