vp-build/common/chroot-style/bwrap.sh
Érico Nogueira 6c7c41b120 common/chroot-style: clean up bwrap.sh.
--dev-bind isn't necessary in any case it was being used for. We can
also use --ro-bind for /void-packages.

A possible future improvement would be to mount / read only during the
actual build.

Also exec bwrap, as done in the uchroot and uunshare chroot styles. And
update homepage.
2021-11-12 23:12:51 -03:00

24 lines
524 B
Bash
Executable File

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