function _pkgSetVarsRPM
{
if test -n "$PKGDIR"; then
- findDir RPMETCDIR $PKGDIR/rpmetc $PKGDIR/base/rpm/etc /etc/rpm
- findDir RPMSTATEDIR $PKGDIR/rpmstate $PKGDIR/base/rpm/state
+ findDir RPMETCDIR $PKGDIR/rpmetc $PKGDIR/base/rpm/etc \
+ $PKGDIR/base/etc/rpm /etc/rpm
+ findDir RPMSTATEDIR $PKGDIR/rpmstate $PKGDIR/base/rpm/state \
+ $PKGDIR/base/var/lib/rpm
findDir RPMLIBDIR $PKGDIR/rpmlib /
fi
}
+function _pkgSetVarsUrpmi
+{
+ if test -n "$PKGDIR"; then
+ findDir URPMIETCDIR $PKGDIR/urpmietc $PKGDIR/base/etc/urpmi /etc/urpmi
+ findDir URPMISTATEDIR $PKGDIR/urpmistate $PKGDIR/base/var/lib/urpmi
+ else
+ findDir URPMIETCDIR "$VDIR"/etc/urpmi /etc/urpmi
+ findDir URPMISTATEDIR "$VDIR"/var/lib/urpmi /var/lib/urpmi
+ fi
+}
+
function _pkgMountBase
{
:
}
+function _pkgMountUrpmi
+{
+ :
+}
+
function _pkgMountRPM
{
_pkgMountBindDir "$RPMETCDIR" /etc/rpm
:
}
+function _pkgSetEnvUrpmi
+{
+ :
+}
+
function _pkgSetEnvRPM
{
CUR_VSERVER=$vserver
rpm) _pkgSetVarsRPM;;
apt) _pkgSetVarsApt;;
yum) _pkgSetVarsYum;;
+ urpmi) _pkgSetVarsUrpmi;;
*) echo "Unknown packaging flavor" >&2; exit 1;;
esac
done
rpm) _pkgMountRPM;;
apt) _pkgMountApt;;
yum) _pkgMountYum;;
+ urpmi) _pkgMountUrpmi;;
esac
done
rpm) _pkgSetEnvRPM;;
apt) _pkgSetEnvApt;;
yum) _pkgSetEnvYum;;
+ urpmi) _pkgSetEnvUrpmi;;
esac
done
test -n "$have_yum" && return 0 || return 1
}
+## Usage: pkgmgmt.isUrpmiAvailable <cfgdir> <vdir> [<is-internal>]
+function pkgmgmt.isUrpmiAvailable
+{
+ local cfgdir="$1"
+ local vdir="$2"
+ local is_internal="$3"
+
+ local have_urpmi i
+ if test -n "$is_internal"; then
+ have_urpmi=1
+ test -d "$cfgdir"/var/lib/urpmi || have_urpmi=
+ else
+ have_urpmi=
+ for i in /bin /usr/bin /usr/local/bin; do
+ test ! -x "$vdir$i"/urpmi || { have_urpmi=1; break; }
+ done
+ fi
+
+ test -n "$have_urpmi" && return 0 || return 1
+}
+
function vshelper.doSanityCheck
{