]> git.pld-linux.org Git - packages/rpm.git/blob - dbupgrade.sh
- cleanup upgrade path from rpm5
[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 ! /usr/lib/rpm/rpmdb_reset -r lsn "$ROOTDIR"/var/lib/rpm/Packages ; then
16         echo
17         echo "rpm database conversion failed!"
18         echo
19         echo "You have to run:"
20         echo
21         echo "  /usr/lib/rpm/rpmdb_reset -r lsn /var/lib/rpm/Packages"
22         echo "  /bin/rm -f /var/lib/rpm/__db.00*"
23         echo "  /bin/rm -f /var/lib/rpm/log/*"
24         echo "  /usr/bin/rpmdb --rebuilddb"
25         echo
26 else
27         /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/__db.00* >/dev/null 2>/dev/null || :
28         /bin/rm --interactive=never -f "$ROOTDIR"/var/lib/rpm/log/* >/dev/null 2>/dev/null || :
29
30         if ! /usr/bin/rpmdb --rebuilddb ${ROOTDIR:+--root="$ROOTDIR"}; then
31                 echo
32                 echo "rpm database conversion failed!"
33                 echo "You have to run /usr/bin/rpmdb manually"
34                 echo
35         fi
36 fi
This page took 0.071974 seconds and 3 git commands to generate.