]> git.pld-linux.org Git - packages/rpm.git/blobdiff - dbupgrade.sh
- use DSA for package signatures for temporary compatibility with antique crap
[packages/rpm.git] / 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.031678 seconds and 4 git commands to generate.