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
|
2023-02-09 09:04:22 +00:00
|
|
|
if ! id "${SUDO_USER:-user}" >/dev/null 2>&1; then
|
2022-05-25 14:02:09 +00:00
|
|
|
if [ ! -e /mmdebstrap-testenv ]; then
|
|
|
|
echo "this test modifies the system and should only be run inside a container" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2023-02-02 06:57:58 +00:00
|
|
|
useradd --home-dir "/home/${SUDO_USER:-user}" --create-home "${SUDO_USER:-user}"
|
2022-05-25 14:02:09 +00:00
|
|
|
fi
|
2023-02-02 06:57:58 +00:00
|
|
|
prefix="runuser -u ${SUDO_USER:-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
|