--- util-vserver-0.30.215/scripts/pkgmgmt 2008-11-17 22:47:02.486514626 +0200 +++ util-vserver-0.30.216-r2844/scripts/pkgmgmt 2009-11-05 14:27:48.753407445 +0200 @@ -185,6 +185,43 @@ test -n "$is_ok" } +## Usage: verifyDBTools +function verifyDBTools +{ + local vdir="$1" + local type="$2" + local host_tool="$3" + local guest_tool="$4" + local res=0 + + local i host_path guest_path + for i in /bin /usr/bin /usr/lib/rpm /usr/local/bin; do + test ! -x "$i"/$host_tool || { host_path="$i"/$host_tool; break; } + done + for i in /bin /usr/bin /usr/lib/rpm /usr/local/bin; do + test ! -x "$vdir$i"/$guest_tool || { guest_path="$i"/$guest_tool; break; } + done + + test -n "$host_path" || { + warning " +* The host does not seem to have the '$host_tool' program which is required + for $type package management. It is suggested to install it before + continuing." + res=1 + } + test -n "$guest_path" || { + warning " +* The vserver guest does not seem to have the '$guest_tool' program which is required + for $type package management. It is suggested to install it before + continuing." + res=1 + } + + eval $host_tool=$host_path + eval $guest_tool=$guest_path + return $res +} + # Usage: verifyInternalPackages