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

Revision 22687, 620 bytes checked in by ghudson, 17 years ago (diff)
Snapshot scripts from /mit/debathena/bin and /mit/debathena/machines/awesome-build-server.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2if [ -z "$vg" ]; then
3    vg=/dev/dink
4fi
5set -x
6for i in $(
7    for dir in "$vg" /var/lib/schroot/mount /var/lib/schroot/session; do
8        cd "$dir"
9        for i in *-*-sbuild-*-*-*-*-*; do
10            echo "$i"
11        done
12    done | \
13    sort -u | grep -v "\*"
14); do
15    schroot -ec "$(echo "$i" | sed 's/-cow$//')"
16    if [ "$1" = "-f" ]; then
17        tac /proc/mounts | cut -d" " -f2 | fgrep "/var/lib/schroot/mount/$i" | xargs -rn1 umount -l
18        lvremove -f "$vg/$i"
19        rmdir /var/lib/schroot/mount/"$i" /var/lib/schroot/session/"$i"
20        if ! [ -e "$vg/$i" ]; then rm "$vg/$i"; fi
21    fi
22done
Note: See TracBrowser for help on using the repository browser.