]> git.pld-linux.org Git - packages/rpm.git/blob - dbupgrade.sh
- delete also tmp dir in database dir
[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 -rf /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 -rf "$ROOTDIR"/var/lib/rpm/log >/dev/null 2>/dev/null || :
29         /bin/rm --interactive=never -rf "$ROOTDIR"/var/lib/rpm/tmp >/dev/null 2>/dev/null || :
30
31         if ! /usr/bin/rpmdb --rebuilddb ${ROOTDIR:+--root="$ROOTDIR"}; then
32                 echo
33                 echo "rpm database conversion failed!"
34                 echo "You have to run /usr/bin/rpmdb manually"
35                 echo
36         fi
37 fi
This page took 0.054901 seconds and 3 git commands to generate.