diff options
Diffstat (limited to 'debian')
-rw-r--r-- | debian/apt.auto-removal.sh | 93 | ||||
-rw-r--r-- | debian/apt.conf.autoremove | 3 | ||||
-rw-r--r-- | debian/apt.dirs | 1 | ||||
-rw-r--r-- | debian/changelog | 66 | ||||
-rwxr-xr-x | debian/rules | 7 |
5 files changed, 164 insertions, 6 deletions
diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh new file mode 100644 index 000000000..4ada56556 --- /dev/null +++ b/debian/apt.auto-removal.sh @@ -0,0 +1,93 @@ +#!/bin/sh + +set -e + +# Author: Steve Langasek <steve.langasek@canonical.com> +# +# Mark as not-for-autoremoval those kernel packages that are: +# - the currently booted version +# - the kernel version we've been called for +# - the latest kernel version (determined using rules copied from the grub +# package for deciding which kernel to boot) +# - the second-latest kernel version, if the booted kernel version is +# already the latest and this script is called for that same version, +# to ensure a fallback remains available in the event the newly-installed +# kernel at this ABI fails to boot +# In the common case, this results in exactly two kernels saved, but it can +# result in three kernels being saved. It's better to err on the side of +# saving too many kernels than saving too few. +# +# We generate this list and save it to /etc/apt/apt.conf.d instead of marking +# packages in the database because this runs from a postinst script, and apt +# will overwrite the db when it exits. + + +eval $(apt-config shell APT_CONF_D Dir::Etc::parts/d) +test -n "${APT_CONF_D}" || APT_CONF_D="/etc/apt/apt.conf.d" +config_file=${APT_CONF_D}/01autoremove-kernels + +eval $(apt-config shell DPKG Dir::bin::dpkg/f) +test -n "$DPKG" || DPKG="/usr/bin/dpkg" + +installed_version="$1" +running_version="$(uname -r)" + + +version_test_gt () +{ + local version_test_gt_sedexp="s/[._-]\(pre\|rc\|test\|git\|old\|trunk\)/~\1/g" + local version_a="`echo "$1" | sed -e "$version_test_gt_sedexp"`" + local version_b="`echo "$2" | sed -e "$version_test_gt_sedexp"`" + $DPKG --compare-versions "$version_a" gt "$version_b" + return "$?" +} + +list=$(${DPKG} -l 'linux-image-[0-9]*'|awk '/^ii/ { print $2 }' | sed -e's/linux-image-//') + +latest_version="" +previous_version="" +for i in $list; do + if version_test_gt "$i" "$latest_version"; then + previous_version="$latest_version" + latest_version="$i" + elif version_test_gt "$i" "$previous_version"; then + previous_version="$i" + fi +done + +if [ "$latest_version" != "$installed_version" ] \ + || [ "$latest_version" != "$running_version" ] \ + || [ "$installed_version" != "$running_version" ] +then + # We have at least two kernels that we have reason to think the + # user wants, so don't save the second-newest version. + previous_version= +fi + +kernels=$(sort -u <<EOF +$latest_version +$installed_version +$running_version +$previous_version +EOF +) + +cat > "$config_file".dpkg-new <<EOF +// File autogenerated by $0, do not edit +APT +{ + NeverAutoRemove + { +EOF +for kernel in $kernels; do + echo " \"^linux-image-${kernel}$\";" >> "$config_file".dpkg-new + echo " \"^linux-image-extra-${kernel}$\";" >> "$config_file".dpkg-new + echo " \"^linux-signed-image-${kernel}$\";" >> "$config_file".dpkg-new + echo " \"^linux-backports-modules-.*-${kernel}$\";" >> "$config_file".dpkg-new + echo " \"^linux-headers-${kernel}$\";" >> "$config_file".dpkg-new +done +cat >> "$config_file".dpkg-new <<EOF + }; +}; +EOF +mv "$config_file".dpkg-new "$config_file" diff --git a/debian/apt.conf.autoremove b/debian/apt.conf.autoremove index c7ad51e66..9684c9c7d 100644 --- a/debian/apt.conf.autoremove +++ b/debian/apt.conf.autoremove @@ -4,10 +4,7 @@ APT { "^firmware-linux.*"; "^linux-firmware$"; - "^linux-image.*"; "^kfreebsd-image.*"; - "^linux-restricted-modules.*"; - "^linux-ubuntu-modules-.*"; "^gnumach$"; "^gnumach-image.*"; }; diff --git a/debian/apt.dirs b/debian/apt.dirs index f9c0b6c3e..6d492a30f 100644 --- a/debian/apt.dirs +++ b/debian/apt.dirs @@ -7,6 +7,7 @@ etc/apt/apt.conf.d etc/apt/preferences.d etc/apt/sources.list.d etc/apt/trusted.gpg.d +etc/kernel/postinst.d etc/logrotate.d var/cache/apt/archives/partial var/lib/apt/lists/partial diff --git a/debian/changelog b/debian/changelog index aa8553251..49dee8800 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,68 @@ +apt (0.9.9.1) unstable; urgency=low + + [ Michael Vogt ] + * debian/rules: + - call dh_clean in clean (closes: #714980) + * apt-pkg/packagemanager.cc: + - increate APT::pkgPackageManager::MaxLoopCount to 5000 + * cherry pick debian/apt.auto-removal.sh feature from the + ubuntu/master branch + + [ Steve Langasek ] + * debian/apt.conf.autoremove: don't include linux-image*, + linux-restricted-modules*, and linux-ubuntu-modules* packages in the + list to never be autoremoved. + * debian/apt.auto-removal.sh, debian/rules, debian/apt.dirs: install new + script to /etc/kernel/postinst.d/ which ensures we only automatically + keep the currently-running kernel, the being-installed kernel, and the + newest kernel, so we don't fill /boot up with an unlimited number of + kernels. LP: #923876. + + [ Adam Conrad ] + * Fix up two things in debian/apt.auto-removal.sh: + - Use exact matches with $-terminated regexes, so we don't get + confusion between similarly-named kernel flavours. + - Keep linux-backports-modules in sync with installed kernels. + + [ David Kalnischkies ] + * Version 3 for DPkg::Pre-Install-Pkgs with MultiArch info (Closes: #712116) + * implement arch+= and arch-= for sources.list + * prevent MarkInstall of unsynced Multi-Arch:same siblings + + -- Michael Vogt <mvo@debian.org> Thu, 11 Jul 2013 20:44:31 +0200 + +apt (0.9.9) unstable; urgency=low + + [ Michael Vogt ] + * improve debug output for the Debug::pkgProblemResolver and + Debug::pkgDepCache::AutoInstall + * improve apt-cdrom output when no CD-ROM can be auto-detected + * document --no-auto-detect in apt-cdrom + + [ David Kalnischkies ] + * build the en manpages in subdirectory doc/en + * remove -ldl from cdrom and -lutil from apt-get linkage + * rewrite pkgOrderList::DepRemove to stop incorrect immediate setting + (Closes: 645713) + * prefer Essentials over Removals in ordering score + * fix priority sorting by prefering higher in MarkInstall + * try all providers in order if uninstallable in MarkInstall + * do unpacks before configures in SmartConfigure (Closes: #707578) + * fix support for multiple patterns in apt-cache search (Closes: #691453) + * set Fail flag in FileFd on all errors consistently + * don't explicitly init ExtractTar InFd with invalid fd + * OpenDescriptor should autoclose fd always on error (Closes: #704608) + * fail in CopyFile if the FileFds have error flag set + * ensure state-dir exists before coyping cdrom files + * fix file location for configure-index.gz in apt.conf(5) (Closes: #711921) + * handle missing "Description" in apt-cache show (Closes: #712435) + * try defaults if auto-detection failed in apt-cdrom (Closes: #712433) + * support \n and \r\n line endings in ReadMessages + * do not redownload unchanged InRelease files + * trigger NODATA error for invalid InRelease files (Closes: #712486) + + -- Michael Vogt <mvo@debian.org> Tue, 02 Jul 2013 08:58:33 +0200 + apt (0.9.8.2) unstable; urgency=low [ Programs translations ] @@ -17,7 +82,6 @@ apt (0.9.8.2) unstable; urgency=low * Fix crash when the "mirror" method does not find any entry (closes: #699303) - [ Johan Kiviniemi ] * cmdline/apt-key: - Create new keyrings with mode 0644 instead of 0600. diff --git a/debian/rules b/debian/rules index 5051dab4f..3979bd810 100755 --- a/debian/rules +++ b/debian/rules @@ -110,6 +110,7 @@ build/build-manpages-stamp: build/configure-stamp clean: dh_testdir + dh_clean [ ! -f Makefile ] || $(MAKE) clean distclean rm -rf build @@ -182,6 +183,8 @@ apt: build build-manpages # apt install # cp debian/apt.conf.autoremove debian/$@/etc/apt/apt.conf.d/01autoremove + cp debian/apt.auto-removal.sh debian/$@/etc/kernel/postinst.d/apt-auto-removal + chmod 755 debian/$@/etc/kernel/postinst.d/apt-auto-removal # make rosetta happy and remove pot files in po/ (but leave stuff # in po/domains/* untouched) and cp *.po into each domain dir @@ -203,7 +206,7 @@ apt: build build-manpages dh_bugfiles -p$@ dh_lintian -p$@ dh_installexamples -p$@ $(BLD)/docs/examples/* - dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) + dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt_MANPAGES))) dh_installcron -p$@ dh_installdocs -p$@ dh_installchangelogs -p$@ @@ -253,7 +256,7 @@ apt-utils: build build-manpages dh_installexamples -p$@ # Install the man pages.. - dh_installman -p$@ $(wildcard $(patsubst %,doc/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES))) + dh_installman -p$@ $(wildcard $(patsubst %,doc/en/%.[158],$(apt-utils_MANPAGES)) $(patsubst %,doc/*/%.*.[158],$(apt-utils_MANPAGES))) dh_installchangelogs -p$@ dh_strip -p$@ |