[debian-lan-devel] [SCM] Debian-LAN development and packaging branch, squeeze, updated. 0.6-22-g856edc4
Andreas B. Mundt
andi at debian.org
Mon Sep 10 14:47:24 UTC 2012
The following commit has been merged in the squeeze branch:
commit 856edc4bed8d78979d840edbe12cc32379efb2d0
Author: Andreas B. Mundt <andi at debian.org>
Date: Mon Sep 10 16:39:34 2012 +0200
Do not replace the old file if the new one is identical.
Dirvish will use a hardlink to the already backuped file if no
modification happened. This part of the commit got lost when
cherry-picked from master branch.
diff --git a/fai/config/files/etc/cron.daily/backup/SERVER_A b/fai/config/files/etc/cron.daily/backup/SERVER_A
index f9aa478..46e369f 100755
--- a/fai/config/files/etc/cron.daily/backup/SERVER_A
+++ b/fai/config/files/etc/cron.daily/backup/SERVER_A
@@ -48,10 +48,22 @@ fi
## the backup, thereby making use of its expire
## mechanism:
if [ -x /usr/sbin/slapcat ] ; then
- slapcat -l $MISC_DIR/LDAP.ldif
+ slapcat -l $MISC_DIR/LDAP.ldif_new
fi
-dpkg --get-selections > $MISC_DIR/package.selection
-debconf-get-selections > $MISC_DIR/debconf.selection
+dpkg --get-selections > $MISC_DIR/package.selection_new
+debconf-get-selections > $MISC_DIR/debconf.selection_new
+
+## Check if the data has changed, if not keep the old file:
+for FILE in `ls $MISC_DIR/*_new` ; do
+ if diff -qN $FILE ${FILE%_new} >/dev/null ; then
+ ## nothing changed:
+ rm $FILE
+ else
+ ## use new file:
+ mv $FILE ${FILE%_new}
+ fi
+done
+
chmod 640 $MISC_DIR/*
## dirvish:
--
Debian-LAN development and packaging
More information about the debian-lan-devel
mailing list