home · contact · privacy
Fix.
authorChristian Heller <c.heller@plomlompom.de>
Thu, 1 May 2025 04:22:41 +0000 (06:22 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Thu, 1 May 2025 04:22:41 +0000 (06:22 +0200)
bookworm/aptmark/server_basic [new file with mode: 0644]
bookworm/scripts/lib/minimize_installation [new file with mode: 0644]
trixie/aptmark/all_old [new symlink]
trixie/aptmark/server_basic_old [new symlink]

diff --git a/bookworm/aptmark/server_basic b/bookworm/aptmark/server_basic
new file mode 100644 (file)
index 0000000..ade9652
--- /dev/null
@@ -0,0 +1,7 @@
+# so we can log in at all …
+openssh-server
+# necessary on _some_ vservers
+net-tools
+quota
+#
+
diff --git a/bookworm/scripts/lib/minimize_installation b/bookworm/scripts/lib/minimize_installation
new file mode 100644 (file)
index 0000000..26006ca
--- /dev/null
@@ -0,0 +1,35 @@
+. lib/apt_get_edited
+. lib/ensure_packages_of_tags
+
+minimize_installation() {
+    _INSTALL_TAGS="$@"
+
+    echo '### minimize_installation: narrow system to what's required explicitly by us and Debian'
+    _PATH_LIST_PREFIX=/tmp/list_
+    _TOK_REQ=' required'
+
+    echo "# Collect packages deemed '${_TOK_REQ}' by Debian: "
+    _PATH_LIST_UNSORTED="${_PATH_LIST_PREFIX}unsorted"
+    dpkg-query -Wf '${Package} ${Priority}\n' | grep "${_TOK_REQ}" | cut -d' ' -f1 > "${_PATH_LIST_UNSORTED}"
+    _PATH_LIST_WHITE="${_PATH_LIST_PREFIX}white"
+    sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_WHITE}"
+    echo $(cat "${_PATH_LIST_WHITE})
+
+    echo -n '# Collect installed packages outside this selection: '
+    dpkg-query -Wf '${Package}\n' > "${_PATH_LIST_UNSORTED}"
+    _PATH_LIST_ALL_PACKAGES="${_PATH_LIST_PREFIX}all_packages"
+    sort "${_PATH_LIST_UNSORTED}" > "${_PATH_LIST_ALL_PACKAGES}"
+    _PATH_LIST_BLACK="${_PATH_LIST_PREFIX}black"
+    comm -3 "${_PATH_LIST_ALL_PACKAGES}" "${_PATH_LIST_WHITE}" > "${_PATH_LIST_BLACK}"
+    echo $(cat "${_PATH_LIST_BLACK})
+
+    echo '# apt-mark auto packages 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}"
+
+    echo '# install or mark as manually installed packages from our own selections …'
+    ensure_packages_of_tags ${_INSTALL_TAGS} 
+
+    echo '# run autopurge to get rid of all unwanted packages …'
+    apt_get_edited '-q -q autopurge'
+}
diff --git a/trixie/aptmark/all_old b/trixie/aptmark/all_old
new file mode 120000 (symlink)
index 0000000..1913f5e
--- /dev/null
@@ -0,0 +1 @@
+../../bookworm/aptmark/all
\ No newline at end of file
diff --git a/trixie/aptmark/server_basic_old b/trixie/aptmark/server_basic_old
new file mode 120000 (symlink)
index 0000000..13ab3c2
--- /dev/null
@@ -0,0 +1 @@
+../../bookworm/aptmark/server_basic
\ No newline at end of file