3
# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
4
# GNU Affero General Public License version 3 (see the file LICENSE).
6
# Buildd Slave tool to mount a chroot
8
# Expects build id as arg 1, makes build-id to contain the build
10
# Needs SUDO to be set to a sudo instance for passwordless access
23
echo "Unmounting chroot for build $BUILDID..."
25
# binfmt-support adds a mount under /proc, which means that our first
26
# pass at umounting fails unless we reverse the list. Leave the while
27
# loop in just to handle pathological cases, too.
29
while $GREP "$HOME/build-$BUILDID/chroot-autobuild" /proc/mounts; do
31
if [ $COUNT -ge 20 ]; then
32
echo "failed to umount $HOME/build-$BUILDID/chroot-autobuild"
33
if [ -x /usr/bin/lsof ]; then
34
/usr/bin/lsof "$HOME/build-$BUILDID/chroot-autobuild"
38
$GREP "$HOME/build-$BUILDID/chroot-autobuild" /proc/mounts | \
39
$CUT -d\ -f2 | LANG=C $SORT -r | $XARGS -r -n 1 $SUDO umount || sleep 1