2018-06-11 14:41:01 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2021-11-11 05:29:32 +01:00
|
|
|
# This chroot script uses bubblewrap (see https://github.com/containers/bubblewrap)
|
2018-06-11 14:41:01 +02:00
|
|
|
#
|
|
|
|
set -e
|
|
|
|
readonly MASTERDIR="$1"
|
|
|
|
readonly DISTDIR="$2"
|
|
|
|
readonly HOSTDIR="$3"
|
|
|
|
readonly EXTRA_ARGS="$4"
|
|
|
|
shift 4
|
|
|
|
|
|
|
|
if ! command -v bwrap >/dev/null 2>&1; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
|
|
|
|
echo "$0 MASTERDIR/DISTDIR not set"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-11-11 05:29:32 +01:00
|
|
|
exec bwrap --bind "$MASTERDIR" / --ro-bind "$DISTDIR" /void-packages \
|
2018-06-11 14:41:01 +02:00
|
|
|
--dev /dev --tmpfs /tmp --proc /proc \
|
2021-11-11 05:29:32 +01:00
|
|
|
${HOSTDIR:+--bind "$HOSTDIR" /host} $EXTRA_ARGS "$@"
|