This commit is contained in:
classabbyamp 2025-07-29 00:10:37 -04:00 committed by GitHub
commit 1db0953136
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 21 additions and 11 deletions

View file

@ -1,30 +1,29 @@
# vim: set ts=4 sw=4 et: # vim: set ts=4 sw=4 et:
install_base_chroot() { install_base_chroot() {
local _bootstrap_arch _target_arch="$1"
[ "$CHROOT_READY" ] && return [ "$CHROOT_READY" ] && return
if [ "$1" = "bootstrap" ]; then if [ "$_target_arch" = "bootstrap" ]; then
unset XBPS_TARGET_PKG XBPS_INSTALL_ARGS _target_arch=""
else unset XBPS_INSTALL_ARGS
XBPS_TARGET_PKG="$1"
fi fi
# binary bootstrap # binary bootstrap
msg_normal "xbps-src: installing base-chroot...\n" msg_normal "xbps-src: installing base-chroot...\n"
# XBPS_TARGET_PKG == arch if [ -n "$_target_arch" ]; then
if [ "$XBPS_TARGET_PKG" ]; then _bootstrap_arch="env XBPS_TARGET_ARCH=$_target_arch"
_bootstrap_arch="env XBPS_TARGET_ARCH=$XBPS_TARGET_PKG"
fi fi
(export XBPS_MACHINE=$XBPS_TARGET_PKG XBPS_ARCH=$XBPS_TARGET_PKG; chroot_sync_repodata) (export XBPS_MACHINE="$_target_arch" XBPS_ARCH="$_target_arch"; chroot_sync_repodata)
${_bootstrap_arch} $XBPS_INSTALL_CMD ${XBPS_INSTALL_ARGS} -y base-chroot ${_bootstrap_arch} $XBPS_INSTALL_CMD ${XBPS_INSTALL_ARGS} -y base-chroot
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
msg_error "xbps-src: failed to install base-chroot!\n" msg_error "xbps-src: failed to install base-chroot!\n"
fi fi
# Reconfigure base-files to create dirs/symlinks. # Reconfigure base-files to create dirs/symlinks.
if xbps-query -r $XBPS_MASTERDIR base-files &>/dev/null; then if xbps-query -r $XBPS_MASTERDIR base-files &>/dev/null; then
XBPS_ARCH=$XBPS_TARGET_PKG xbps-reconfigure -r $XBPS_MASTERDIR -f base-files &>/dev/null XBPS_ARCH="$_target_arch" xbps-reconfigure -r $XBPS_MASTERDIR -f base-files &>/dev/null
fi fi
msg_normal "xbps-src: installed base-chroot successfully!\n" msg_normal "xbps-src: installed base-chroot successfully!\n"
chroot_prepare $XBPS_TARGET_PKG || msg_error "xbps-src: failed to initialize chroot!\n" chroot_prepare "$_target_arch" || msg_error "xbps-src: failed to initialize chroot!\n"
chroot_check chroot_check
chroot_handler clean chroot_handler clean
} }

View file

@ -502,7 +502,18 @@ setup_pkg() {
# Check if base-chroot is already installed. # Check if base-chroot is already installed.
if [ -z "$bootstrap" -a -z "$CHROOT_READY" -a "z$show_problems" != "zignore-problems" ]; then if [ -z "$bootstrap" -a -z "$CHROOT_READY" -a "z$show_problems" != "zignore-problems" ]; then
msg_red "${pkg} is not a bootstrap package and cannot be built without it.\n" msg_red "${pkg} is not a bootstrap package and cannot be built without it.\n"
msg_error "Please install bootstrap packages and try again.\n" # if this isn't a script, ask to bootstrap
if [ -t 1 ]; then
msg_normal "Would you like to binary-bootstrap for ${XBPS_MACHINE} in ${XBPS_MASTERDIR}?"
read -rp " [Y/n] " _bin_bootstrap_resp
[ -z "$_bin_bootstrap_resp" ] && _bin_bootstrap_resp=y
fi
if [ "${_bin_bootstrap_resp,,}" = "y" ]; then
msg_normal "binary bootstrapping for ${XBPS_MACHINE} in ${XBPS_MASTERDIR}...\n"
install_base_chroot "$XBPS_MACHINE"
else
msg_error "Please run '${PROGNAME} -A ${XBPS_MACHINE} binary-bootstrap' or install bootstrap packages, then try again.\n"
fi
fi fi
sourcepkg="${pkgname}" sourcepkg="${pkgname}"