From ed681e0053d94f62d90b1343afaeacfe11a91577 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Fri, 28 Mar 2014 00:34:33 +0100 Subject: Improve auto-install marking packages: Compute list of essential packages, and be more conservative about additional packages. Drop bugnumbers really about the opposite goal as our tweak. --- tweaks/base | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tweaks/base b/tweaks/base index e0572ec..0835d09 100644 --- a/tweaks/base +++ b/tweaks/base @@ -1,8 +1,26 @@ ## tidy loose ends... set -e -# fix mark auto-installed packages as such -# tracked at https://bugs.debian.org/730162, https://bugs.debian.org/739938 -chroot /target apt-mark auto acpi acpi-support-base acpid adduser apt apt-utils aptitude-common base-files base-passwd bash bash-completion bsdmainutils bsdutils busybox coreutils cpio cron dash debconf debconf-i18n debian-archive-keyring debianutils diffutils dmidecode dpkg e2fslibs e2fsprogs findutils fonts-freefont-ttf gcc-4.7-base gnupg gpgv grep groff-base grub-common gzip hostname ifupdown initramfs-tools initscripts insserv install-info iproute isc-dhcp-client isc-dhcp-common keyboard-configuration kmod laptop-detect linux-image-amd64 locales login logrotate lsb-base mawk mount multiarch-support ncurses-base ncurses-bin net-tools netbase netcat-traditional passwd pciutils perl-base procps readline-common rsyslog sed sensible-utils sysv-rc sysvinit sysvinit-utils tar tasksel tasksel-data tzdata udev usbutils util-linux uuid-runtime vim-common xz-utils zlib1g +# fix mark auto-installed essential packages and their dependencies +_pkgdeps(){ set -e + chroot /target dpkg-query -Wf=',${Pre-Depends},${Depends},${Recommends}\n' $* 2>/dev/null|sed -r -e 's/[,|] *([a-z0-9.+-]+)?(:\s+)?( *[^|,]*)?/\1\n/g'|sed '/^$/d'|sort -u; } +_pkg2re(){ set -e + echo $*|sed -r -e 's/\s+/\|/g;s/^\|//;s/([.+-])/\\\1/g;s/\|$//'; } +_pkgreal(){ set -e + chroot /target dpkg-query -Wf='${Package},${Provides},\n'|sed -r "/,,/d;s/^([a-z0-9.+-]+).*[,|] *($(_pkg2re $*))[ :,]/\1/;/,/d"; } +_pkganddeepdeps(){ set -e + local rest=$* + local all=$rest + for i in 1 2 3 4 5 + do local deps=$(_pkgdeps $rest) + rest="$deps $(_pkgreal $deps)" + all="$all $rest" + done + echo $all|sed -r 's/\s+/\n/g'|sort -u; } +essentials=$(chroot /target dpkg-query -Wf='${Package}%${Essential}\n'|sed -r 's/(.*)%yes/\1/;/%/d') +chroot /target apt-mark auto $(_pkganddeepdeps $essentials apt linux-image-*) +# fix mark auto-installed d-i installed packages unusable on their own +chroot /target apt-mark auto aptitude-common grub-common isc-dhcp-common tasksel-data vim-common + # keep backup of any tweaked (i.e. edited or created) config file _backup(){ set -e [ -e "$1.orig" ] || if [ -e "$1" ]; then cp -a "$1" "$1.orig" -- cgit v1.2.3