diff options
author | Jonas Smedegaard <dr@jones.dk> | 2002-03-29 12:59:48 +0000 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2002-03-29 12:59:48 +0000 |
commit | 9967bb7063b9ce81a8f85a15641ac96090ccf3b7 (patch) | |
tree | 238d7a9660696bf7b456709181b8274b163c5059 | |
parent | dcbe394d6d9dac47d651db97ba9f041a943eb320 (diff) |
Backup both .dpkg-new, .old and .orig style config differences - and document the difference.
-rwxr-xr-x | localbackupconfig | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/localbackupconfig b/localbackupconfig index a9b1e25..8176da7 100755 --- a/localbackupconfig +++ b/localbackupconfig @@ -3,17 +3,33 @@ # /usr/local/sbin/localbackupconfig # Copyright 2001 Jonas Smedegaard <dr@jones.dk> # -# $Id: localbackupconfig,v 1.1 2002-03-25 15:52:49 jonas Exp $ +# $Id: localbackupconfig,v 1.2 2002-03-29 12:59:48 jonas Exp $ +# +# .dpkg-new files appear when refusing to update a conffile on package update +# +# .orig files you should save yourself before customizing a configfile +# +# .old files are for customizing when you don't have the original (anymore) # FQDN=`hostname -f` BACKUPDIR=/var/local/backups/$FQDN find $BASE -path '*Attachments*' -size +15000k -exec rm '{}' ';' -for i in `find /etc -name '*.orig' | sed -e 's,\.orig$,,'`; do +for i in `find /etc -name '*.orig' -o -name '*.dpkg-new' | sed -e 's,\.\(orig\|dpkg-new\)$,,' | sort -u`; do if [ -e $i ]; then + if [ -e $i.dpkg-new ]; then + orig="$i.dpkg-new" + elif [ -e $i.orig ]; then + orig="$i.orig" + elif [ -e $i.old ]; then + orig="$i.old" + else + echo "What the f... Original for \"$i\" has disappeared again?!?" + exit 1 + fi mkdir -p $BACKUPDIR/`dirname $i` cp -fa $i $BACKUPDIR/$i - diff -ruN $i.orig $i > $BACKUPDIR/$i.diff + diff -ruN $orig $i > $BACKUPDIR/$i.diff fi done |