- $personality vserver $VERBOSE $vserver start
- [ "$pkg_method" = "yum" ] && $personality vserver $VERBOSE $vserver exec sh -c "rm -f /var/lib/rpm/__db*"
- [ "$pkg_method" = "yum" ] && $personality vserver $VERBOSE $vserver exec rpm --rebuilddb
+ # redirect out/err to protect against the vserver's init sequence getting stalled
+ # mostly used for f10 vservers created remotely through ssh
+ $personality vserver $VERBOSE $vserver start >& /dev/null
+
+ if [ "$pkg_method" == "yum" ] ; then
+ $personality vserver $VERBOSE $vserver exec sh -c "rm -f /var/lib/rpm/__db*"
+
+ # run the host rpmdb_dump and restore with the guest rpmdb_load
+ function translate_rpm_hashes () {
+ set -x
+ set -e
+ local personality="$1"; shift
+ local vserver="$1"; shift
+ # need to have utilities installed
+ type -p file
+ type -p awk
+ type -p cut
+ guest_dir=/var/lib/rpm
+ host_dir=/vservers/$vserver/$guest_dir
+ files=$(cd $host_dir ; file * | grep Hash | cut -d: -f 1)
+ for file in $files; do
+ (cd $host_dir && mv $file ${file}-foreign)
+ /usr/lib/rpm/rpmdb_dump $host_dir/${file}-foreign | $personality vserver $VERBOSE $vserver exec /usr/lib/rpm/rpmdb_load $guest_dir/$file
+ done
+ $personality vserver $VERBOSE $vserver exec rpm --rebuilddb
+ return 0
+ }