chroot_sandboxes/debian/create_environment
Jarvis Carroll 91d85c8ecc kerl erlang/zx/gajudesk script
This needed a 64-bit debian system to build, so I guess I'll just test
64 bit systems from now on.
2025-05-30 10:23:16 +10:00

43 lines
912 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
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 amd64 sid "$FRESH" http://deb.debian.org/debian/
fi
if test -e "$ROOT"
then
echo "Existing installation found at $ROOT, removing."
./cleanup
fi
echo "Copying $FRESH to $ROOT."
cp -r "$FRESH" "$ROOT"
echo "Initializing $ROOT."
./cleanup add_mounts
# Don't bother creating a new tmpfs. We don't want to leak files in, and we
# don't want to waste more RAM on a second tmpfs. The whole thing is
# temporary, after all.
chmod 1777 "$ROOT/tmp"
cp -r install_scripts "$ROOT/root"
chroot "$ROOT" /root/install_scripts/user_setup "$@"
./cleanup mounts