#!/bin/sh if test `id -u` -ne 0 then echo "$0 must be run as root." return fi ROOT=test_environment FRESH=clean_environment if test -e "$FRESH" then echo "Clean debian environment found at $FRESH. Good." else echo "No debian environment found at $FRESH, downloading with debootstrap." mkdir -p $FRESH ./get_debootstrap --arch i386 sid "$FRESH" http://deb.debian.org/debian/ fi cleanup_mount() { if mountpoint "$1" > /dev/null then echo "Unmounting $1" umount "$1" fi } if test -e "$ROOT" then echo "Existing installation found at $ROOT, removing." ./destroy_environment fi echo "Copying $FRESH to $ROOT." cp -r "$FRESH" "$ROOT" echo "Initializing $ROOT." mkdir -p "$ROOT/proc" mount proc $ROOT/proc -t proc mkdir -p "$ROOT/sys" mount sysfs $ROOT/sys -t sysfs