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

Revision 22688, 777 bytes checked in by ghudson, 17 years ago (diff)
Add leading comments documenting (hopefully correctly) the scripts snapshotted from /mit/debathena/bin. * debathena/scripts/dadch, debathena/scripts/clean-schroot, debathena/scripts/da, debathena/scripts/daequivsupload, debathena/scripts/upgrade-schroot, debathena/scripts/daupload-release, debathena/scripts/sbuildhack, debathena/scripts/all-schroots: Comment.
  • 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
8if [ -z "$vg" ]; then
9    vg=/dev/dink
10fi
11set -x
12for i in $(
13    for dir in "$vg" /var/lib/schroot/mount /var/lib/schroot/session; do
14        cd "$dir"
15        for i in *-*-sbuild-*-*-*-*-*; do
16            echo "$i"
17        done
18    done | \
19    sort -u | grep -v "\*"
20); do
21    schroot -ec "$(echo "$i" | sed 's/-cow$//')"
22    if [ "$1" = "-f" ]; then
23        tac /proc/mounts | cut -d" " -f2 | fgrep "/var/lib/schroot/mount/$i" | xargs -rn1 umount -l
24        lvremove -f "$vg/$i"
25        rmdir /var/lib/schroot/mount/"$i" /var/lib/schroot/session/"$i"
26        if ! [ -e "$vg/$i" ]; then rm "$vg/$i"; fi
27    fi
28done
Note: See TracBrowser for help on using the repository browser.