]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- add '-r' option to specify root directory of rpm database,
authorJan Rękorajski <baggins@pld-linux.org>
Wed, 28 Nov 2012 11:22:40 +0000 (12:22 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Wed, 28 Nov 2012 11:22:40 +0000 (12:22 +0100)
  mainly for use with util-vserver and external package management

dbupgrade.sh

index 52c073af9c15cd9e638e0573e70ecb55f58539f7..2d403b563ebdf05bddab1dbf5bc531a5c1bd83df 100755 (executable)
@@ -1,6 +1,18 @@
 #!/bin/sh
 
-if ! /usr/lib/rpm/bin/rpmdb_reset -r lsn /var/lib/rpm/Packages ; then
+ROOTDIR=
+if [ "$1" = "-r" ]; then
+       shift
+       ROOTDIR="$1"
+
+       if [ ! -d "$ROOTDIR" ]; then
+               echo "Specified root directory ($ROOTDIR) does not exist!"
+               echo "Bailing out!"
+               exit
+       fi
+fi
+
+if ! /usr/lib/rpm/bin/rpmdb_reset -r lsn "$ROOTDIR"/var/lib/rpm/Packages ; then
        echo
        echo "rpm database conversion failed!"
        echo
@@ -12,10 +24,10 @@ if ! /usr/lib/rpm/bin/rpmdb_reset -r lsn /var/lib/rpm/Packages ; then
        echo "  /usr/lib/rpm/bin/dbconvert --rebuilddb"
        echo
 else
-       /bin/rm --interactive=never -f /var/lib/rpm/__db.00* >/dev/null 2>/dev/null || :
-       /bin/rm --interactive=never -f /var/lib/rpm/log/* >/dev/null 2>/dev/null || :
+       /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/__db.00* >/dev/null 2>/dev/null || :
+       /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/log/* >/dev/null 2>/dev/null || :
 
-       if ! /usr/lib/rpm/bin/dbconvert --rebuilddb; then
+       if ! /usr/lib/rpm/bin/dbconvert --rebuilddb ${ROOTDIR:+--root="$ROOTDIR"}; then
                echo
                echo "rpm database conversion failed!"
                echo "You have to run /usr/lib/rpm/bin/dbconvert manually"
This page took 0.047552 seconds and 4 git commands to generate.