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

@ -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=$?