1
0
Fork 0
mirror of https://github.com/xHyroM/void-packages.git synced 2024-11-22 06:31:05 +01:00
void-packages/common/chroot-style/bwrap.sh
2024-03-29 08:12:19 +01:00

23 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 "$@"