Require xbps>=0.44 for xbps-uunshare(8) to simplify code.

This commit is contained in:
Juan RP 2015-03-12 18:56:14 +01:00
parent d694d022d1
commit 5c177c7b67
3 changed files with 19 additions and 37 deletions

View File

@ -15,7 +15,7 @@ are isolated (among others).
### Requirements
- GNU bash
- xbps >= 0.43.1
- xbps >= 0.44
### Quick setup in Void

View File

@ -145,13 +145,9 @@ chroot_sync_repos() {
if [ -z "$XBPS_SKIP_REMOTEREPOS" ]; then
# Make sure to sync index for remote repositories.
if command -v xbps-uunshare &>/dev/null; then
xbps-uunshare $XBPS_MASTERDIR /usr/sbin/xbps-install -S
if [ $? -eq 99 ]; then
# userns not supported, fallback to uchroot
xbps-uchroot $XBPS_MASTERDIR /usr/sbin/xbps-install -S
fi
else
xbps-uunshare $XBPS_MASTERDIR /usr/sbin/xbps-install -S
if [ $? -eq 99 ]; then
# userns not supported, fallback to uchroot
xbps-uchroot $XBPS_MASTERDIR /usr/sbin/xbps-install -S
fi
fi
@ -164,11 +160,10 @@ chroot_sync_repos() {
cp -a $XBPS_MASTERDIR/var/db/xbps/keys/*.plist \
$XBPS_MASTERDIR/usr/$XBPS_CROSS_TRIPLET/var/db/xbps/keys
# Make sure to sync index for remote repositories.
if command -v xbps-uunshare &>/dev/null; then
env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH \
xbps-uunshare $XBPS_MASTERDIR /usr/sbin/xbps-install \
-r /usr/$XBPS_CROSS_TRIPLET -S
else
env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH \
xbps-uunshare $XBPS_MASTERDIR /usr/sbin/xbps-install \
-r /usr/$XBPS_CROSS_TRIPLET -S
if [ $? -eq 99 ]; then
env XBPS_TARGET_ARCH=$XBPS_TARGET_ARCH \
xbps-uchroot $XBPS_MASTERDIR /usr/sbin/xbps-install \
-r /usr/$XBPS_CROSS_TRIPLET -S
@ -212,16 +207,10 @@ chroot_handler() {
esac
if [ "$action" = "chroot" ]; then
if command -v xbps-uunshare &>/dev/null; then
xbps-uunshare ${_chargs} $XBPS_MASTERDIR /bin/xbps-shell
rv=$?
if [ $rv -eq 99 ]; then
# userns not supported, fallback to uchroot
xbps-uchroot ${_chargs} $XBPS_MASTERDIR /bin/xbps-shell
rv=$?
fi
else
# uunshare not available
xbps-uunshare ${_chargs} $XBPS_MASTERDIR /bin/xbps-shell
rv=$?
if [ $rv -eq 99 ]; then
# userns not supported, fallback to uchroot
xbps-uchroot ${_chargs} $XBPS_MASTERDIR /bin/xbps-shell
rv=$?
fi
@ -240,18 +229,11 @@ chroot_handler() {
[ -n "$XBPS_BINPKG_EXISTS" ] && arg="$arg -E"
action="$arg $action"
if command -v xbps-uunshare &>/dev/null; then
env -i PATH="/usr/bin:/usr/sbin:$PATH" HOME=/tmp IN_CHROOT=1 LANG=en_US.UTF-8 \
xbps-uunshare ${_chargs} $XBPS_MASTERDIR /void-packages/xbps-src $action $pkg
rv=$?
if [ $rv -eq 99 ]; then
# userns not supported, fallback to uchroot
env -i PATH="/usr/bin:/usr/sbin:$PATH" HOME=/tmp IN_CHROOT=1 LANG=en_US.UTF-8 \
xbps-uchroot ${_chargs} $XBPS_MASTERDIR /void-packages/xbps-src $action $pkg
rv=$?
fi
else
# uunshare not available
env -i PATH="/usr/bin:/usr/sbin:$PATH" HOME=/tmp IN_CHROOT=1 LANG=en_US.UTF-8 \
xbps-uunshare ${_chargs} $XBPS_MASTERDIR /void-packages/xbps-src $action $pkg
rv=$?
if [ $rv -eq 99 ]; then
# userns not supported, fallback to uchroot
env -i PATH="/usr/bin:/usr/sbin:$PATH" HOME=/tmp IN_CHROOT=1 LANG=en_US.UTF-8 \
xbps-uchroot ${_chargs} $XBPS_MASTERDIR /void-packages/xbps-src $action $pkg
rv=$?

View File

@ -337,7 +337,7 @@ read_pkg() {
setup_pkg $XBPS_TARGET_PKG $XBPS_CROSS_BUILD
}
readonly XBPS_VERSION_REQ="0.43.1"
readonly XBPS_VERSION_REQ="0.44"
readonly XBPS_VERSION=$(xbps-uhelper -V|awk '{print $2}')
readonly XBPS_SRC_VERSION="113"
export XBPS_MACHINE=$(uname -m)
@ -384,7 +384,7 @@ readonly REQHOST_UTILS_BOOTSTRAP="gawk bash bison sed gcc g++ msgfmt makeinfo \
# Required utilities in host system for chroot ops.
readonly REQHOST_UTILS="xbps-install xbps-query xbps-rindex xbps-uhelper \
xbps-reconfigure xbps-remove xbps-create git"
xbps-reconfigure xbps-remove xbps-create xbps-uchroot xbps-uunshare git"
check_reqhost_utils