Index: debian/univention-corporate-client.univention-config-registry-variables =================================================================== --- debian/univention-corporate-client.univention-config-registry-variables (Revision 39962) +++ debian/univention-corporate-client.univention-config-registry-variables (Arbeitskopie) @@ -15,3 +15,15 @@ Description[en]=Timeout in seconds for upstart job ucc-syspol if the network can not be started (default: 10) Type=str Categories=system-desktop + +[ucc/update/remove/old/kernel] +Description[de]=Alte Kernel-Pakete werden vor der Verwaltung von Software-Paketen mit apt-get entfernt (default: true) +Description[en]=Remove old kernel packages before managing software packages with apt-get (default: true) +Type=str +Categories=system-desktop + +[ucc/update/remove/old/kernel/pkgregex] +Description[de]=Regulärer Ausdruck für die Suche nach Kernel-Paketen (default: linux-image-[[:digit:]]) +Description[en]=Regular expression used for search for kernel packages (default: linux-image-[[:digit:]]) +Type=str +Categories=system-desktop Index: debian/univention-corporate-client.dirs =================================================================== --- debian/univention-corporate-client.dirs (Revision 39962) +++ debian/univention-corporate-client.dirs (Arbeitskopie) @@ -3,3 +3,4 @@ usr/share/univention-lib usr/share/keyrings etc/network/if-up.d +usr/share/univention-corporate-client/apt-pre-invoke.d Index: debian/univention-corporate-client.postinst =================================================================== --- debian/univention-corporate-client.postinst (Revision 39962) +++ debian/univention-corporate-client.postinst (Arbeitskopie) @@ -42,7 +42,8 @@ univention-config-registry set version/version=1.0 univention-config-registry set version/releasename=Weser +univention-config-registry set ucc/update/remove/old/kernel?true apt-key add /usr/share/keyrings/ucc-archive-key.gpg -exit 0 \ No newline at end of file +exit 0 Index: debian/univention-corporate-client.install =================================================================== --- debian/univention-corporate-client.install (Revision 39962) +++ debian/univention-corporate-client.install (Arbeitskopie) @@ -10,3 +10,4 @@ ucc-archive-key.gpg /usr/share/keyrings univention-ucc-fetch-system-policies usr/sbin univention-ucc-software-update usr/sbin +apt-get-pre-invoke.d/univention-ucc-prune-old-kernel-packages usr/share/univention-corporate-client/apt-pre-invoke.d/ Index: debian/univention-corporate-client.univention-config-registry =================================================================== --- debian/univention-corporate-client.univention-config-registry (Revision 39962) +++ debian/univention-corporate-client.univention-config-registry (Arbeitskopie) @@ -4,3 +4,6 @@ Type: file File: etc/rsyslog.d/100-ucc.conf Variables: grub/append + +Type: file +File: etc/apt/apt.conf.d/900-ucc-pre-invoke Index: apt-get-pre-invoke.d/univention-ucc-prune-old-kernel-packages =================================================================== --- apt-get-pre-invoke.d/univention-ucc-prune-old-kernel-packages (Revision 0) +++ apt-get-pre-invoke.d/univention-ucc-prune-old-kernel-packages (Revision 0) @@ -0,0 +1,83 @@ +#!/bin/bash +# +# Univention Corporate Client +# remove old, unused kernel packages +# +# Copyright 2013 Univention GmbH +# +# http://www.univention.de/ +# +# All rights reserved. +# +# The source code of this program is made available +# under the terms of the GNU Affero General Public License version 3 +# (GNU AGPL V3) as published by the Free Software Foundation. +# +# Binary versions of this program provided by Univention to you as +# well as other copyrighted, protected or trademarked materials like +# Logos, graphics, fonts, specific documentations and configurations, +# cryptographic keys etc. are subject to a license agreement between +# you and Univention and not subject to the GNU AGPL V3. +# +# In the case you use this program under the terms of the GNU AGPL V3, +# the program is provided in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public +# License with the Debian GNU/Linux or Univention distribution in file +# /usr/share/common-licenses/AGPL-3; if not, see +# . + +# returns latest kernel package for given kernel version + +export LC_ALL=C +export DEBIAN_FRONTEND=noninteractive + +removeOldKernelPackages () { + + local kernel_regex="$1" + local running_kernel="$(uname -r)" + + local pkg="" + local pkg_ver="" + local latest_pkg="" + local latest_pkg_ver="" + local kernel_packages="" + + # remove all $kernel_regex packages except + # the running kernel + for pkg in $(dpkg-query -W -f '${Package}\n' | grep "$kernel_regex" | sort -n); do + if [ "$(dpkg-query -W -f='${Status}\n' "$pkg" 2>/dev/null)" = "install ok installed" ]; then + kernel_packages="$kernel_packages $pkg" + pkg_ver="$(dpkg-query -W -f '${Version}\n' $pkg)" + if dpkg --compare-versions "$pkg_ver" gt "$latest_pkg_ver" ; then + latest_pkg_ver="$pkg_ver" + latest_pkg="$pkg" + fi + fi + done + + # remove kernel package + for i in $kernel_packages; do + # do not remove running and latest kernel + if ! echo "$i" | grep -q "$running_kernel\|$latest_pkg"; then + echo "removing kernel as requested in $0" + dpkg -P $i || true + fi + done + +} + +remove=$(/usr/sbin/ucr get ucc/update/remove/old/kernel) +remove_regex=$(/usr/sbin/ucr get ucc/update/remove/old/kernel/pkgregex) + +if [ -n "$remove" -a "$remove" = "true" ]; then + if [ -z "$remove_regex" ]; then + remove_regex="linux-image-[[:digit:]]" + fi + removeOldKernelPackages "$remove_regex" +fi + +exit 0 Eigenschaftsänderungen: apt-get-pre-invoke.d/univention-ucc-prune-old-kernel-packages ___________________________________________________________________ Hinzugefügt: svn:executable + *