]> git.pld-linux.org Git - packages/rpm.git/blob - dbupgrade.sh
- reset/cleanup rpmdb only if the current backend is bdb, sqlite backend uses differe...
[packages/rpm.git] / dbupgrade.sh
1 #!/bin/sh
2
3 ROOTDIR=
4 if [ "$1" = "-r" ]; then
5         shift
6         ROOTDIR="$1"
7
8         if [ ! -d "$ROOTDIR" ]; then
9                 echo "Specified root directory ($ROOTDIR) does not exist!"
10                 echo "Bailing out!"
11                 exit
12         fi
13 fi
14
15 if [ -f "$ROOTDIR"/var/lib/rpm/Packages ]; then
16         if ! /usr/lib/rpm/rpmdb_reset -r lsn "$ROOTDIR"/var/lib/rpm/Packages ; then
17                 echo
18                 echo "rpm database conversion failed!"
19                 echo
20                 echo "You have to run:"
21                 echo
22                 echo "  /usr/lib/rpm/rpmdb_reset -r lsn /var/lib/rpm/Packages"
23                 echo "  /bin/rm -f /var/lib/rpm/__db.00*"
24                 echo "  /bin/rm -rf /var/lib/rpm/log"
25                 echo "  /usr/bin/rpmdb --rebuilddb"
26                 echo
27                 exit
28         fi
29
30         /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/__db.00* >/dev/null 2>/dev/null || :
31         /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/log >/dev/null 2>/dev/null || :
32         /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/tmp >/dev/null 2>/dev/null || :
33 fi
34
35 if ! /usr/bin/rpmdb --rebuilddb ${ROOTDIR:+--root="$ROOTDIR"}; then
36         echo
37         echo "rpm database conversion failed!"
38         echo "You have to run /usr/bin/rpmdb manually"
39         echo
40 fi
This page took 0.053423 seconds and 3 git commands to generate.