[debian-lan-devel] [SCM] Debian-LAN development and packaging branch, squeeze, updated. 0.6-21-gc55483e

Andreas B. Mundt andi at debian.org
Sun Sep 9 15:04:48 UTC 2012


The following commit has been merged in the squeeze branch:
commit c55483ee59c7043680b5d9a1fecd26cb06bc0063
Author: Andreas B. Mundt <andi at debian.org>
Date:   Wed Sep 5 11:26:20 2012 +0200

    Use dirvish to backup LDAP, package- and debconf-selection.
    
    Backups should expire after some time.  To use dirvish's expire
    mechanism also for LDAP data, package- and debconf-selection, a daily
    snapshot is dropped into a directory which is in turn backed up by
    dirvish.

diff --git a/fai/config/files/etc/cron.daily/backup/SERVER_A b/fai/config/files/etc/cron.daily/backup/SERVER_A
index 92aa8fb..f9aa478 100755
--- a/fai/config/files/etc/cron.daily/backup/SERVER_A
+++ b/fai/config/files/etc/cron.daily/backup/SERVER_A
@@ -7,9 +7,7 @@
 set -e
 
 DIR="/backup/"
-LDIF_DIR="${DIR}/ldap/"
-DPKG_DIR="${DIR}/dpkg/"
-DATE=`date +%F`
+MISC_DIR="${DIR}/tmp/misc/"
 
 # from dirvish:
 mount_check() {
@@ -45,26 +43,16 @@ if grep -q ${DIR%/} /etc/fstab ; then
     trap "rc=$?; umount $DIR; exit $rc" ERR
 fi
 
-## backup ldap:
+## Backup LDAP, package selection and debconf data.
+## Drop the data in $MISC_DIR and use dirvish for
+## the backup, thereby making use of its expire
+## mechanism:
 if [ -x /usr/sbin/slapcat ] ; then
-    if [ ! -d $LDIF_DIR ] ; then
-        mkdir -p $LDIF_DIR
-	chmod 750 $LDIF_DIR
-    fi
-    slapcat -l $LDIF_DIR/$DATE.ldif
-    gzip -f    $LDIF_DIR/$DATE.ldif
-fi
-
-## backup package selection and debconf data:
-if [ ! -d $DPKG_DIR ] ; then
-    mkdir -p $DPKG_DIR
-    chmod 750 $DPKG_DIR
+    slapcat -l $MISC_DIR/LDAP.ldif
 fi
-
-dpkg --get-selections > $DPKG_DIR/$DATE.dpkg
-gzip -f    $DPKG_DIR/$DATE.dpkg
-debconf-get-selections > $DPKG_DIR/$DATE.debconf
-gzip -f    $DPKG_DIR/$DATE.debconf
+dpkg --get-selections  > $MISC_DIR/package.selection
+debconf-get-selections > $MISC_DIR/debconf.selection
+chmod 640 $MISC_DIR/*
 
 ## dirvish:
 if [ ! -x /usr/sbin/dirvish-expire  ]; then exit 0; fi
diff --git a/fai/config/scripts/SERVER_A/70-dirvish b/fai/config/scripts/SERVER_A/70-dirvish
index 5dd9521..e431bd0 100755
--- a/fai/config/scripts/SERVER_A/70-dirvish
+++ b/fai/config/scripts/SERVER_A/70-dirvish
@@ -4,10 +4,11 @@
 
 set -e
 
-## all backed up directories:
-BANK_DIRS="/etc /srv/fai/config /root /lan/mainserver/home0"
-
 BACKUP_DIR="/backup/"
+MISC_DIR="${BACKUP_DIR}/tmp/misc/"
+
+## all backed up directories:
+BANK_DIRS="/etc /srv/fai/config /root /lan/mainserver/home0 $MISC_DIR"
 
 fcopy -v /etc/cron.daily/backup
 rm -vf   $target/etc/cron.d/dirvish
@@ -42,6 +43,8 @@ EOF
 ## Do the following only once when installing,
 ## as /backup might not be mounted in general:
 if [ $FAI_ACTION == "install" ] ; then
+    mkdir -vp $target/$MISC_DIR
+    chmod 750 $target/$MISC_DIR
     for DIR in $BANK_DIRS ; do
 	ID=`basename $DIR`
 	echo "Creating dirvish config $ID for $DIR."

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list