Johannes Schauer Marin Rodrigues
4c3fddcd54
- multiple individual shell scripts instead of one 3.5k line monster - tests driven by Python script allowing: * declarative test description in coverage.txt * collecting errors instead of aborting on first error * skipping tests * running specific tests
35 lines
1.2 KiB
Bash
35 lines
1.2 KiB
Bash
#!/bin/sh
|
|
#
|
|
# we are testing all variants here because with 0.7.5 we had a bug:
|
|
# mmdebstrap sid /dev/null --simulate ==> E: cannot read /var/cache/apt/archives/
|
|
|
|
set -eu
|
|
export LC_ALL=C.UTF-8
|
|
prefix=
|
|
include=
|
|
if [ "$(id -u)" -eq 0 ] && [ "{{ MODE }}" != root ] && [ "{{ MODE }}" != auto ]; then
|
|
# this must be qemu
|
|
if ! id -u user >/dev/null 2>&1; then
|
|
if [ ! -e /mmdebstrap-testenv ]; then
|
|
echo "this test modifies the system and should only be run inside a container" >&2
|
|
exit 1
|
|
fi
|
|
adduser --gecos user --disabled-password user
|
|
fi
|
|
if [ "{{ MODE }}" = unshare ]; then
|
|
if [ ! -e /mmdebstrap-testenv ]; then
|
|
echo "this test modifies the system and should only be run inside a container" >&2
|
|
exit 1
|
|
fi
|
|
sysctl -w kernel.unprivileged_userns_clone=1
|
|
fi
|
|
prefix="runuser -u user --"
|
|
if [ "{{ MODE }}" = extract ] || [ "{{ MODE }}" = custom ]; then
|
|
include="--include=$(cat pkglist.txt | tr '\n' ',')"
|
|
fi
|
|
fi
|
|
$prefix {{ CMD }} --mode={{ MODE }} $include --dry-run --variant={{ VARIANT }} {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
|
|
if [ -e /tmp/debian-chroot.tar ]; then
|
|
echo "/tmp/debian-chroot.tar must not be created with --dry-run" >&2
|
|
exit 1
|
|
fi
|