From e12c6ef8aed1b5569f6902d6706645f7907482d1 Mon Sep 17 00:00:00 2001 From: Andrea Brancaleoni Date: Mon, 11 Jun 2018 14:41:01 +0200 Subject: [PATCH] xbps-src: include new chroot implementation (bubblewrap) --- common/chroot-style/bwrap.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 common/chroot-style/bwrap.sh diff --git a/common/chroot-style/bwrap.sh b/common/chroot-style/bwrap.sh new file mode 100755 index 00000000000..dc1fca461a6 --- /dev/null +++ b/common/chroot-style/bwrap.sh @@ -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 "$@"