diff --git a/debian/changelog b/debian/changelog index bbfaa5b4..737465ac 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +livecd-rootfs (2.525.36) UNRELEASED; urgency=medium + + * Preserve apt preferences created by any package we install (i.e. + ubuntu-advantage-tools) against live-build's attempt to delete them. + (LP: #1855354) + + -- Michael Hudson-Doyle Thu, 19 Dec 2019 15:43:56 +1300 + livecd-rootfs (2.525.35) bionic; urgency=medium * Did not expect the bionic branch being so outdated. Backport support diff --git a/live-build/auto/build b/live-build/auto/build index 014012db..e1e18a37 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -261,6 +261,12 @@ EOF lb chroot "$@" + if [ -d chroot/etc/apt/preferences.d.save ]; then + # https://twitter.com/infinite_scream + mv chroot/etc/apt/preferences.d.save/* chroot/etc/apt/preferences.d/ + rmdir chroot/etc/apt/preferences.d.save + fi + if [ "${SUBPROJECT:-}" = minimized ]; then # force removal of initramfs-tools, which we assert is not # required for any minimized images but is still pulled in by diff --git a/live-build/auto/config b/live-build/auto/config index 4f025b66..f9d31e94 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -1039,6 +1039,19 @@ rm -f /etc/fstab EOF fi +if [ $PROJECT != ubuntu-cpc ]; then + cat > config/hooks/100-preserve-apt-prefs.chroot <<\EOF +#! /bin/sh -ex + +# live-build "helpfully" removes /etc/apt/preferences.d/* so we put a +# copy somewhere it won't touch it. + +if [ -n "$(ls -A /etc/apt/preferences.d)" ]; then + cp -a /etc/apt/preferences.d /etc/apt/preferences.d.save +fi +EOF +fi + if [ $PROJECT = ubuntukylin ]; then cat > config/hooks/100-ubuntukylin.chroot <