From 48a35a0f5f33877cfe9e682d3f43d35177adbd45 Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Tue, 7 Jan 2025 18:08:53 +0100 Subject: [PATCH] Mark packages as automatically installed This way a later "apt autoremove" will also remove library/leaf packages installed by the initial bootstrap. --- chroot-script | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/chroot-script b/chroot-script index 4f68ca7..1542d57 100755 --- a/chroot-script +++ b/chroot-script @@ -83,6 +83,14 @@ askpass() { } # }}} +# mark existing packages as automatically installed {{{ +markauto() { + # Mark most leaf packages as automatically installed. + # Later in the systems life, apt autoremove will remove them if possible. + apt-mark auto '~i !~M ?not(?priority(required)) ?not(?priority(important)) ?not(?priority(standard))' +} +# }}} + # define chroot mirror {{{ chrootmirror() { if [ "$KEEP_SRC_LIST" = "yes" ] ; then @@ -810,7 +818,7 @@ trap signal_handler HUP INT QUIT TERM # always execute install_policy_rcd install_policy_rcd - for i in chrootmirror grmlrepos backportrepos kernelimg_conf \ + for i in markauto chrootmirror grmlrepos backportrepos kernelimg_conf \ kernel packages extrapackages reconfigure hosts \ default_locales timezone fstab install_fs_tools hostname \ initrd grub_install passwords \