2022-05-25 14:02:09 +00:00
|
|
|
#!/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=
|
2022-11-16 12:59:38 +00:00
|
|
|
include=,
|
2022-05-25 14:02:09 +00:00
|
|
|
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 --"
|
2022-11-16 13:02:58 +00:00
|
|
|
if [ "{{ VARIANT }}" = extract ] || [ "{{ VARIANT }}" = custom ]; then
|
2022-11-16 12:59:38 +00:00
|
|
|
include="$(tr '\n' ',' < pkglist.txt)"
|
2022-05-25 14:02:09 +00:00
|
|
|
fi
|
|
|
|
fi
|
2022-11-16 12:59:38 +00:00
|
|
|
$prefix {{ CMD }} --mode={{ MODE }} --include="$include" --dry-run --variant={{ VARIANT }} {{ DIST }} /tmp/debian-chroot.tar {{ MIRROR }}
|
2022-05-25 14:02:09 +00:00
|
|
|
if [ -e /tmp/debian-chroot.tar ]; then
|
|
|
|
echo "/tmp/debian-chroot.tar must not be created with --dry-run" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|