From 5c177c7b6766404aeb8d61eb4a8f7d3400951ecb Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 12 Mar 2015 18:56:14 +0100 Subject: [PATCH] Require xbps>=0.44 for xbps-uunshare(8) to simplify code. --- README.md | 2 +- common/xbps-src/shutils/chroot.sh | 50 ++++++++++--------------------- xbps-src | 4 +-- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index f060a382a5..3b558b42e5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ are isolated (among others). ### Requirements - GNU bash -- xbps >= 0.43.1 +- xbps >= 0.44 ### Quick setup in Void diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh index 9cf02cde3d..747b5743e6 100644 --- a/common/xbps-src/shutils/chroot.sh +++ b/common/xbps-src/shutils/chroot.sh @@ -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=$? diff --git a/xbps-src b/xbps-src index 84ca53e13d..55165c21e7 100755 --- a/xbps-src +++ b/xbps-src @@ -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