Browse Source

apt_upgrade: use dpkg -P instead of apt-get to remove obsolete kernels

to avoid troubles caused by a previous run that failed because of /boot space

Signed-off-by: Alejandro Mery <amery@hanoverdisplays.com>
master
Alejandro Mery 8 years ago
committed by Alejandro Mery
parent
commit
05dc537cf6
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      files/bin/apt_upgrade

+ 6
- 6
files/bin/apt_upgrade

@ -20,7 +20,7 @@ obsolete_kernels() {
COLUMNS=500 dpkg -l "linux*$v*" | sed -n -e 's|^.. \(linux[^ \]\+\)[ \t].*|\1|p'
done | while read p; do
case "$p" in
*$current*|*$latest*)
*-$current|*-$current-*|*-$latest|*-$latest-*)
echo "$p: SKIP" >&2
;;
*)
@ -32,7 +32,8 @@ obsolete_kernels() {
fi
}
remove=$(obsolete_kernels "$(uname -r)" \
remove=$(obsolete_kernels \
"$(uname -r | sed -e 's|-generic$||')" \
$(ls -1 /boot/vmlinuz-* | \
sed -e 's|^/boot/vmlinuz-||' -e 's|\.efi\.signed$||' -e 's|-generic$||' | \
sort -urV))
@ -40,11 +41,10 @@ remove=$(obsolete_kernels "$(uname -r)" \
aptget="apt-get${apt_opt:+ $apt_opt}"
cmd="$aptget update"
cmd="$cmd && $aptget autoremove --purge"
if [ -n "$remove" ]; then
cmd="$cmd && $aptget remove --purge $remove"
cmd="$cmd && dpkg -P $remove"
fi
cmd="$cmd && $aptget autoremove --purge"
cmd="$cmd && $aptget upgrade && $aptget dist-upgrade"
set -x
exec sudo sh -c "$cmd"

Loading…
Cancel
Save