]> git.pld-linux.org Git - packages/rpm.git/commitdiff
- reset/cleanup rpmdb only if the current backend is bdb, sqlite backend uses differe...
authorJan Rękorajski <baggins@pld-linux.org>
Sun, 1 Nov 2020 09:44:09 +0000 (10:44 +0100)
committerJan Rękorajski <baggins@pld-linux.org>
Sun, 1 Nov 2020 09:44:09 +0000 (10:44 +0100)
dbupgrade.sh

index a000935734caf47e94854e4c763421b375aa9224..575aeb2b45bf94197958626f76093f4855a3e8ab 100755 (executable)
@@ -12,26 +12,29 @@ if [ "$1" = "-r" ]; then
        fi
 fi
 
-if ! /usr/lib/rpm/rpmdb_reset -r lsn "$ROOTDIR"/var/lib/rpm/Packages ; then
-       echo
-       echo "rpm database conversion failed!"
-       echo
-       echo "You have to run:"
-       echo
-       echo "  /usr/lib/rpm/rpmdb_reset -r lsn /var/lib/rpm/Packages"
-       echo "  /bin/rm -f /var/lib/rpm/__db.00*"
-       echo "  /bin/rm -rf /var/lib/rpm/log"
-       echo "  /usr/bin/rpmdb --rebuilddb"
-       echo
-else
-       /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/__db.00* >/dev/null 2>/dev/null || :
-       /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/log >/dev/null 2>/dev/null || :
-       /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/tmp >/dev/null 2>/dev/null || :
-
-       if ! /usr/bin/rpmdb --rebuilddb ${ROOTDIR:+--root="$ROOTDIR"}; then
+if [ -f "$ROOTDIR"/var/lib/rpm/Packages ]; then
+       if ! /usr/lib/rpm/rpmdb_reset -r lsn "$ROOTDIR"/var/lib/rpm/Packages ; then
                echo
                echo "rpm database conversion failed!"
-               echo "You have to run /usr/bin/rpmdb manually"
                echo
+               echo "You have to run:"
+               echo
+               echo "  /usr/lib/rpm/rpmdb_reset -r lsn /var/lib/rpm/Packages"
+               echo "  /bin/rm -f /var/lib/rpm/__db.00*"
+               echo "  /bin/rm -rf /var/lib/rpm/log"
+               echo "  /usr/bin/rpmdb --rebuilddb"
+               echo
+               exit
        fi
+
+       /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/__db.00* >/dev/null 2>/dev/null || :
+       /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/log >/dev/null 2>/dev/null || :
+       /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/tmp >/dev/null 2>/dev/null || :
+fi
+
+if ! /usr/bin/rpmdb --rebuilddb ${ROOTDIR:+--root="$ROOTDIR"}; then
+       echo
+       echo "rpm database conversion failed!"
+       echo "You have to run /usr/bin/rpmdb manually"
+       echo
 fi
This page took 0.037145 seconds and 4 git commands to generate.