1 --- util-vserver-0.30.216-pre3038/scripts/pkgmgmt~ 2013-05-27 17:13:26.567683113 +0300
2 +++ util-vserver-0.30.216-pre3038/scripts/pkgmgmt 2013-05-27 17:13:05.566763191 +0300
7 +## Usage: verifyDBTools <vdir> <type> <host_tool> <guest_tool>
8 +function verifyDBTools
12 + local host_tool="$3"
13 + local guest_tool="$4"
18 + hostbdb=$(ldd /bin/rpm | awk '/libdb-[0-9\.]+.so/ { sub(/libdb-/, "", $1); sub(/.so/, "", $1); print $1 }')
19 + guestbdb=$(ldd "$vdir"/bin/rpm | awk '/libdb-[0-9\.]+.so/ { sub(/libdb-/, "", $1); sub(/.so/, "", $1); print $1 }')
20 + local i host_path guest_path
21 + for i in /bin /usr/bin /usr/lib/rpm /usr/local/bin; do
22 + test ! -x "$i"/db${hostbdb}_$host_tool || { host_path="$i"/"db${hostbdb}_${host_tool}"; break; }
24 + for i in /bin /usr/bin /usr/lib/rpm /usr/local/bin; do
25 + test ! -x "$vdir$i"/db${guestbdb}_$guest_tool || { guest_path="$i"/"db${guestbdb}_${guest_tool}"; break; }
28 + test -n "$host_path" || {
30 +* The host does not seem to have the 'db${hostbdb}_${host_tool}' program which is required
31 + for $type package management. It is suggested to install it before
35 + test -n "$guest_path" || {
37 +* The vserver guest does not seem to have the '"db${guestbdb}_${guest_tool}"' program which is required
38 + for $type package management. It is suggested to install it before
43 + eval db_$host_tool=$host_path
44 + eval db_$guest_tool=$guest_path
48 # Usage: verifyInternalPackages <vserver> <style>
49 function verifyInternalPackages()
52 verifyInternalPackages "$vserver" RH || test -n "$IS_FORCE" ||
54 Can not continue; use '--force' to override this check"
56 + verifyDBTools "$vdir" 'internal' dump load || test -n "$IS_FORCE" ||
58 +Can not continue; use '--force' to override this check"
61 pushd "$vdir" >/dev/null
63 test ! -L var/lib/rpm || {
65 findDir RPMETCDIR "$cfgdir"/rpmetc "$cfgdir"/base/rpm/etc /etc/rpm /
66 findDir RPMSTATEDIR "$cfgdir"/rpmstate "$cfgdir"/base/rpm/state
68 + verifyDBTools "$vdir" 'external' load dump || test -n "$IS_FORCE" ||
70 +Can not continue; use '--force' to override this check"
72 mkdir -m755 -p "$cfgdir"
76 pushd "$vdir" >/dev/null
77 ## remove %_dbpath settings
78 _substFile /etc/rpm/macros '/^%_dbpath[ \t].*/D'
80 + ## remove vserver-packages ignore
81 + _substFile /etc/poldek/poldek.conf '/^ignore[ \t]*=/s/vserver-packages//'
83 + # dump and reload rpmdb to overcome db version mismatch problems
84 + if [ "$db_load" -a "$db_dump" ]; then
85 + # dump with host db_dump
86 + $db_dump var/lib/rpm/Packages > var/lib/rpm/.Packages.dump
88 + # load with guest db_load.
89 + $_RM -f var/lib/rpm/__db.*
90 + mv var/lib/rpm/{Packages,.Packages.ORIG}
91 + chroot . $db_load var/lib/rpm/Packages < var/lib/rpm/.Packages.dump
92 + chroot . bin/rpm --rebuilddb 2>/dev/null
93 + rm -f var/lib/rpm/.Packages.*
99 + pushd "$vdir" >/dev/null
100 + if [ "$db_load" -a "$db_dump" ]; then
101 + # dump and reload rpmdb to overcome db version mismatch problems
103 + # dump with guest db_dump
104 + $_RM -f var/lib/rpm/__db.*
105 + chroot . $db_dump var/lib/rpm/Packages > var/lib/rpm/.Packages.dump
107 + # load with host db_load
108 + mv var/lib/rpm/{Packages,.Packages.ORIG}
109 + $db_load var/lib/rpm/Packages < var/lib/rpm/.Packages.dump
110 + rm -f var/lib/rpm/.Packages.*
114 if test -n "$have_poldek"; then
115 _copySecureRev "$vdir" /etc/poldek "$POLDEKETCDIR"
116 _unhashAuto "$POLDEKETCDIR"/poldek.conf '/'