summaryrefslogtreecommitdiff
path: root/tweaks
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2014-03-28 00:34:33 +0100
committerJonas Smedegaard <dr@jones.dk>2014-03-28 09:11:25 +0100
commited681e0053d94f62d90b1343afaeacfe11a91577 (patch)
treee44224ce424ce8bb98482c29d045eec1a795e9f4 /tweaks
parent78438bb6d1373ddc565110e8baf1b17fd01e869b (diff)
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.
Diffstat (limited to 'tweaks')
-rw-r--r--tweaks/base24
1 files 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"