diff --git a/debian/cleanup_everything b/debian/cleanup_everything new file mode 100755 index 0000000..0cbb542 --- /dev/null +++ b/debian/cleanup_everything @@ -0,0 +1,32 @@ +#!/bin/sh + +if test `id -u` -ne 0 +then + echo "$0 must be run as root." + return +fi + +if test -d test_environment +then + # Call this script that automatically unmounts the mount points too. + ./destroy_environment +fi + +if test -d clean_environment +then + echo "Removing clean_environment" + rm -r clean_environment +fi + +if test -d debootstrap +then + echo "Removing debootstrap" + rm -r debootstrap +fi + +if test -f debootstrap.tar.gz +then + echo "Removing debootstrap.tar.gz" + rm debootstrap.tar.gz +fi + diff --git a/debian/get_debootstrap b/debian/get_debootstrap index 49384fc..8124267 100755 --- a/debian/get_debootstrap +++ b/debian/get_debootstrap @@ -1,23 +1,33 @@ #!/bin/sh -# Finds debootstrap in $PATH, or the current directory, or download some -# version of it if none is found. +# Finds debootstrap in $PATH, or download some version of it if not found. +# This script prefers to use local copies that are already downloaded, over +# system-wide installations, in case you want to test on some specific +# outdated version of debootstrap. -IT_LOCAL=`pwd`/debootstrap/debootstrap -if test -e "$IT_LOCAL" +download_it() { + curl http://deb.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.128+nmu2+deb12u2.tar.gz --output debootstrap.tar.gz + tar xf debootstrap.tar.gz && rm debootstrap.tar.gz +} + +LOCALDIR=`pwd`/debootstrap +if test -e "$LOCALDIR/debootstrap" then - IT="$IT_LOCAL" - echo "Found $IT in current directory" + echo "Found $LOCALDIR/debootstrap in current directory" + + # Run debootstrap without installing it to the system. + DEBOOTSTRAP_DIR="$LOCALDIR" "$LOCALDIR/debootstrap" "$@" elif IT=`command -v debootstrap` then echo "Found $IT in PATH" -else - echo "debootstrap not found. Downloading to $IT_LOCAL." - curl http://deb.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.128+nmu2+deb12u2.tar.gz --output debootstrap.tar.gz - tar xf debootstrap.tar.gx - IT="$IT_LOCAL" + # Use the version of debootstrap that was already installed. + debootstrap "$@" +else + echo "debootstrap not found. Downloading to $LOCALDIR." + download_it + + # Run debootstrap without installing it to the system. + DEBOOTSTRAP_DIR="$LOCALDIR" "$LOCALDIR/debootstrap" "$@" fi -# Run debootstrap. -"$IT" "$@"