2015-04-09 18:57:41 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2021-08-18 12:59:00 +02:00
|
|
|
# This chroot script uses xbps-uchroot(1).
|
2015-04-09 18:57:41 +02:00
|
|
|
#
|
|
|
|
readonly MASTERDIR="$1"
|
|
|
|
readonly DISTDIR="$2"
|
|
|
|
readonly HOSTDIR="$3"
|
2015-12-12 10:12:33 +01:00
|
|
|
readonly EXTRA_ARGS="$4"
|
2015-06-07 10:52:48 +02:00
|
|
|
readonly CMD="$5"
|
|
|
|
shift 5
|
2015-04-09 18:57:41 +02:00
|
|
|
|
2024-02-18 09:15:55 +01:00
|
|
|
msg_red() {
|
|
|
|
# error messages in bold/red
|
|
|
|
[ -n "$NOCOLORS" ] || printf >&2 "\033[1m\033[31m"
|
|
|
|
printf "=> ERROR: %s\\n" "$@" >&2
|
|
|
|
[ -n "$NOCOLORS" ] || printf >&2 "\033[m"
|
|
|
|
}
|
|
|
|
|
|
|
|
readonly XBPS_UCHROOT_CMD="$(command -v xbps-uchroot 2>/dev/null)"
|
|
|
|
|
|
|
|
if [ -z "$XBPS_UCHROOT_CMD" ]; then
|
|
|
|
msg_red "could not find xbps-uchroot"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! [ -x "$XBPS_UCHROOT_CMD" ]; then
|
|
|
|
msg_red "xbps-uchroot is not executable. Are you in the $(stat -c %G "$XBPS_UCHROOT_CMD") group?"
|
2015-04-09 18:57:41 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-02-18 09:15:55 +01:00
|
|
|
if [ -z "$MASTERDIR" ] || [ -z "$DISTDIR" ]; then
|
|
|
|
msg_red "$0: MASTERDIR/DISTDIR not set"
|
2015-04-09 18:57:41 +02:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-04-16 14:15:15 +02:00
|
|
|
exec xbps-uchroot $EXTRA_ARGS -b $DISTDIR:/void-packages ${HOSTDIR:+-b $HOSTDIR:/host} -- $MASTERDIR $CMD $@
|