source: trunk/debathena/scripts/clean-schroots @ 22727

Revision 22727, 753 bytes checked in by ghudson, 16 years ago (diff)
Support volume groups other than "dink" on build servers. * debathena/scripts/clean-schroots, debathena/scripts/build-server/make-chroot: Allow VG environment variable setting to override the hardcoded /dev/dink.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# Usage: clean-schroots
4
5# Remove any LVM snapshots and chroots left behind by schroot.  Not
6# normally necessary as schroot should clean up after itself.
7
8: ${VG=/dev/dink}
9set -x
10for i in $(
11    for dir in "$VG" /var/lib/schroot/mount /var/lib/schroot/session; do
12        cd "$dir"
13        for i in *-*-sbuild-*-*-*-*-*; do
14            echo "$i"
15        done
16    done | \
17    sort -u | grep -v "\*"
18); do
19    schroot -ec "$(echo "$i" | sed 's/-cow$//')"
20    if [ "$1" = "-f" ]; then
21        tac /proc/mounts | cut -d" " -f2 | fgrep "/var/lib/schroot/mount/$i" | xargs -rn1 umount -l
22        lvremove -f "$VG/$i"
23        rmdir /var/lib/schroot/mount/"$i" /var/lib/schroot/session/"$i"
24        if ! [ -e "$VG/$i" ]; then rm "$VG/$i"; fi
25    fi
26done
Note: See TracBrowser for help on using the repository browser.