summaryrefslogtreecommitdiff
path: root/localbackupconfig
blob: 8176da740d8cd1ea5d15d0d14790eea00d9baac4 (plain)
  1. #!/bin/sh
  2. #
  3. # /usr/local/sbin/localbackupconfig
  4. # Copyright 2001 Jonas Smedegaard <dr@jones.dk>
  5. #
  6. # $Id: localbackupconfig,v 1.2 2002-03-29 12:59:48 jonas Exp $
  7. #
  8. # .dpkg-new files appear when refusing to update a conffile on package update
  9. #
  10. # .orig files you should save yourself before customizing a configfile
  11. #
  12. # .old files are for customizing when you don't have the original (anymore)
  13. #
  14. FQDN=`hostname -f`
  15. BACKUPDIR=/var/local/backups/$FQDN
  16. find $BASE -path '*Attachments*' -size +15000k -exec rm '{}' ';'
  17. for i in `find /etc -name '*.orig' -o -name '*.dpkg-new' | sed -e 's,\.\(orig\|dpkg-new\)$,,' | sort -u`; do
  18. if [ -e $i ]; then
  19. if [ -e $i.dpkg-new ]; then
  20. orig="$i.dpkg-new"
  21. elif [ -e $i.orig ]; then
  22. orig="$i.orig"
  23. elif [ -e $i.old ]; then
  24. orig="$i.old"
  25. else
  26. echo "What the f... Original for \"$i\" has disappeared again?!?"
  27. exit 1
  28. fi
  29. mkdir -p $BACKUPDIR/`dirname $i`
  30. cp -fa $i $BACKUPDIR/$i
  31. diff -ruN $orig $i > $BACKUPDIR/$i.diff
  32. fi
  33. done