[7857] in Release_7.7_team

home help back first fref pref prev next nref lref last post

recovery hook to clean up /boot

daemon@ATHENA.MIT.EDU (Jonathan Reed)
Tue Dec 18 12:36:52 2012

Date: Tue, 18 Dec 2012 12:36:43 -0500 (EST)
From: Jonathan Reed <jdreed@MIT.EDU>
To: release-team@MIT.EDU
Message-ID: <alpine.DEB.2.02.1212181234020.23665@infinite-loop.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII

We apaprently filled up /boot on a bunch of cluster workstations, and 
users are helpfully getting notified about this.  We need to clean it up.

I propose the following recovery hook.  (Cluster workstations should only 
have linux-image-generic).   I plan to push this out on the 26th unless 
people object.  (I'm not here on the 21st, and, uh, that's a bad day to 
push out additional things)

Silence will be interpreted as approval.

#!/bin/bash

kernels=$(dpkg-query -W -f '${Package}\n' linux-image-\*-generic | sed -e 
's/^linux-image-//' | sort -V)
numkernels=$(echo "$kernels" | wc -l)
if [ $numkernels -le 2 ]; then
     exit 0
fi
toremove=$(echo "$kernels" | head -$(($numkernels-2)))
kpkgs=
for k in $toremove; do
     if [ "$(uname -r)" != "$k" ]; then
 	kpkgs="$kpkgs linux-image-$k"
     fi
done
if apt-get -s remove $kpkgs; then
     apt-get remove $kpkgs
fi



home help back first fref pref prev next nref lref last post