xbps-src: include new chroot implementation (bubblewrap)

This commit is contained in:
Andrea Brancaleoni 2018-06-11 14:41:01 +02:00 committed by Andrea Brancaleoni
parent 505bdeeaa7
commit e12c6ef8ae
1 changed files with 23 additions and 0 deletions

23
common/chroot-style/bwrap.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
#
# This chroot script uses bubblewrap (see https://github.com/projectatomic/bubblewrap)
#
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
bwrap --dev-bind "$MASTERDIR" / --dev-bind "$DISTDIR" /void-packages \
--dev /dev --tmpfs /tmp --proc /proc \
${HOSTDIR:+--dev-bind "$HOSTDIR" /host} $EXTRA_ARGS "$@"