Fix get_debootstrap script
Now it extracts and calls the program properly, if it isn't already installed. Also, the script `debian/cleanup_everything` removes debootstrap and both of the created Debian roots, returning the repository to the same state it clones in as.
This commit is contained in:
parent
c29250e550
commit
4f6ee7cc88
32
debian/cleanup_everything
vendored
Executable file
32
debian/cleanup_everything
vendored
Executable file
@ -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
|
||||
|
36
debian/get_debootstrap
vendored
36
debian/get_debootstrap
vendored
@ -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" "$@"
|
||||
|
Loading…
x
Reference in New Issue
Block a user