| 12345678910111213141516171819202122232425262728293031 |
- #!/bin/sh
- dbdir=/var/lib/dpkg
- # Backup the 7 last versions of dpkg databases containing user data.
- if cd /var/backups ; then
- # We backup all relevant database files if any has changed, so that
- # the rotation number always contains an internally consistent set.
- dbchanged=no
- dbfiles="arch status diversions statoverride"
- for db in $dbfiles ; do
- if ! cmp -s dpkg.${db}.0 $dbdir/$db ; then
- dbchanged=yes
- break;
- fi
- done
- if [ "$dbchanged" = "yes" ] ; then
- for db in $dbfiles ; do
- cp -p $dbdir/$db dpkg.$db
- savelog -c 7 dpkg.$db >/dev/null
- done
- fi
- # The alternatives database is independent from the dpkg database.
- if ! test -e alternatives.tar.0 ||
- ! tar -df alternatives.tar.0 -C $dbdir alternatives >/dev/null ; then
- tar -cf alternatives.tar -C $dbdir alternatives
- savelog -c 7 -J alternatives.tar >/dev/null
- fi
- fi
|