[7858] in Release_7.7_team
Re: recovery hook to clean up /boot
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Wed Dec 19 16:18:26 2012
Date: Wed, 19 Dec 2012 13:18:18 -0800 (PST)
From: Geoffrey Thomas <geofft@MIT.EDU>
To: Jonathan Reed <jdreed@MIT.EDU>
cc: release-team@MIT.EDU
In-Reply-To: <alpine.DEB.2.02.1212181234020.23665@infinite-loop.mit.edu>
Message-ID: <alpine.DEB.2.00.1212191317490.5325@team-rocket.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Looks reasonable. But do we need a recovery hook for this, or can we push
this logic into the autoupdater and wait for its next run?
--
Geoffrey Thomas
geofft@mit.edu
On Tue, 18 Dec 2012, Jonathan Reed wrote:
> 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
>
>
>