chroot_sandboxes/debian/destroy_environment
2025-05-23 13:42:14 +10:00

29 lines
427 B
Bash
Executable File

#!/bin/sh
if test `id -u` -ne 0
then
echo "$0 must be run as root."
return
fi
ROOT=test_environment
cleanup_mount() {
if mountpoint "$1" > /dev/null
then
echo "Unmounting $1"
umount "$1"
fi
}
if test -e "$ROOT"
then
cleanup_mount "$ROOT/proc"
cleanup_mount "$ROOT/sys"
echo "Removing $ROOT"
rm -r "$ROOT"
else
echo "No environment found at $ROOT. Doing nothing."
fi