
A bit fiddly, but this lets us run a realistic erlang install script from userspace, and then re-enter userspace later without wiping the installation.
31 lines
491 B
Bash
Executable File
31 lines
491 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/dev/pts"
|
|
cleanup_mount "$ROOT/dev"
|
|
cleanup_mount "$ROOT/sys"
|
|
cleanup_mount "$ROOT/proc"
|
|
echo "Removing $ROOT"
|
|
rm -r "$ROOT"
|
|
else
|
|
echo "No environment found at $ROOT. Doing nothing."
|
|
fi
|
|
|