1 --- util-vserver-0.30.215/scripts/pkgmgmt 2008-11-17 22:47:02.486514626 +0200
2 +++ util-vserver-0.30.216-r2844/scripts/pkgmgmt 2009-11-05 14:27:48.753407445 +0200
7 +## Usage: verifyDBTools <vdir> <type> <host_tool> <guest_tool>
8 +function verifyDBTools
12 + local host_tool="$3"
13 + local guest_tool="$4"
16 + local i host_path guest_path
17 + for i in /bin /usr/bin /usr/lib/rpm /usr/local/bin; do
18 + test ! -x "$i"/$host_tool || { host_path="$i"/$host_tool; break; }
20 + for i in /bin /usr/bin /usr/lib/rpm /usr/local/bin; do
21 + test ! -x "$vdir$i"/$guest_tool || { guest_path="$i"/$guest_tool; break; }
24 + test -n "$host_path" || {
26 +* The host does not seem to have the '$host_tool' program which is required
27 + for $type package management. It is suggested to install it before
31 + test -n "$guest_path" || {
33 +* The vserver guest does not seem to have the '$guest_tool' program which is required
34 + for $type package management. It is suggested to install it before
39 + eval $host_tool=$host_path
40 + eval $guest_tool=$guest_path
44 # Usage: verifyInternalPackages <vserver> <style>
45 function verifyInternalPackages()
48 verifyInternalPackages "$vserver" RH || test -n "$IS_FORCE" ||
50 Can not continue; use '--force' to override this check"
52 + verifyDBTools "$vdir" 'internal' db_dump db_load || test -n "$IS_FORCE" ||
54 +Can not continue; use '--force' to override this check"
57 pushd "$vdir" >/dev/null
59 test ! -L var/lib/rpm || {
61 findDir RPMETCDIR "$cfgdir"/rpmetc "$cfgdir"/base/rpm/etc /etc/rpm /
62 findDir RPMSTATEDIR "$cfgdir"/rpmstate "$cfgdir"/base/rpm/state
64 + verifyDBTools "$vdir" 'external' db_load db_dump || test -n "$IS_FORCE" ||
66 +Can not continue; use '--force' to override this check"
68 mkdir -m755 -p "$cfgdir"
72 pushd "$vdir" >/dev/null
73 ## remove %_dbpath settings
74 _substFile /etc/rpm/macros '/^%_dbpath[ \t].*/D'
76 + ## remove vserver-packages ignore
77 + _substFile /etc/poldek/poldek.conf '/^ignore[ \t]*=/s/vserver-packages//'
79 + # dump and reload rpmdb to overcome db version mismatch problems
80 + if [ "$db_load" -a "$db_dump" ]; then
81 + # dump with host db_dump
82 + $db_dump var/lib/rpm/Packages > var/lib/rpm/.Packages.dump
84 + # load with guest db_load.
85 + $_RM -f var/lib/rpm/__db.*
86 + mv var/lib/rpm/{Packages,.Packages.ORIG}
87 + chroot . $db_load var/lib/rpm/Packages < var/lib/rpm/.Packages.dump
88 + chroot . bin/rpm --rebuilddb 2>/dev/null
89 + rm -f var/lib/rpm/.Packages.*
95 + pushd "$vdir" >/dev/null
96 + if [ "$db_load" -a "$db_dump" ]; then
97 + # dump and reload rpmdb to overcome db version mismatch problems
99 + # dump with guest db_dump
100 + $_RM -f var/lib/rpm/__db.*
101 + chroot . $db_dump var/lib/rpm/Packages > var/lib/rpm/.Packages.dump
103 + # load with host db_load
104 + mv var/lib/rpm/{Packages,.Packages.ORIG}
105 + $db_load var/lib/rpm/Packages < var/lib/rpm/.Packages.dump
106 + rm -f var/lib/rpm/.Packages.*
110 if test -n "$have_poldek"; then
111 _copySecureRev "$vdir" /etc/poldek "$POLDEKETCDIR"
112 _unhashAuto "$POLDEKETCDIR"/poldek.conf '/'