[debian-lan-devel] [SCM] Debian-LAN development and packaging branch, master, updated. 0.7-2-g8d1dd7d

Andreas B. Mundt andi at debian.org
Wed Dec 5 21:10:01 UTC 2012


The following commit has been merged in the master branch:
commit 8d1dd7dc2374d91856ee7abbe50c1735e071368b
Author: Andreas B. Mundt <andi at debian.org>
Date:   Sat Dec 1 09:38:25 2012 +0100

    Allow the conversion of an existing installation to the mainserver.
    
    This allows setting up the mainserver from a minimal standard Debian
    installation:
    
      * install the base system, hostname "mainserver" with the
        debian installer
      * install fai-quickstart
      * copy the debian-lan config space in place
      * disable starting services
      * run "fai -vN -s file:///srv/fai/config softupdate"
      * enable services and reboot
    
    Minor fixes might be needed after conversion, see documentation.

diff --git a/fai/config/scripts/DNS_SERVER/10-zones b/fai/config/scripts/DNS_SERVER/10-zones
index ebe097f..1c607ae 100755
--- a/fai/config/scripts/DNS_SERVER/10-zones
+++ b/fai/config/scripts/DNS_SERVER/10-zones
@@ -2,12 +2,6 @@
 #
 set -e
 
-if [ $FAI_ACTION != "install" ]; then
-    exit 0
-fi
-
-ainsl /etc/bind/named.conf.local "include \"/etc/bind/localzones\";"
-
 ## Generate the DNS configuration.
 ## Use variables from corresponding class/*.var file.
 
@@ -17,6 +11,12 @@ PREFIX1=`echo $SUBNET | cut -d "." --fields=1`
 PREFIX2=`echo $SUBNET | cut -d "." --fields=2`
 FILE="/etc/bind/db.${PREFIX1}.${PREFIX2}"
 
+if [ -e $target$FILE ]; then
+    exit 0
+fi
+
+ainsl /etc/bind/named.conf.local "include \"/etc/bind/localzones\";"
+
 cat > $target/etc/bind/localzones <<EOF
 zone "${PREFIX2}.${PREFIX1}.in-addr.arpa" {
         type master;
diff --git a/fai/config/scripts/FAISERVER/20-configspace b/fai/config/scripts/FAISERVER/20-configspace
index 4870b5f..2d1c124 100755
--- a/fai/config/scripts/FAISERVER/20-configspace
+++ b/fai/config/scripts/FAISERVER/20-configspace
@@ -4,7 +4,7 @@ set -e
 
 CONFDIR="/srv/fai/config"
 
-if [ $FAI_ACTION == "install" ] ; then
+if [ "$FAI_ACTION" == "install" ] ; then
     ## Copy the config space to the faiserver:
     echo -n "Cleaning config space ... "
     rm -rf $target/$CONFDIR
@@ -12,10 +12,12 @@ if [ $FAI_ACTION == "install" ] ; then
 
     mkdir -p $target/$CONFDIR
     cp -a /var/lib/fai/config/* $target/$CONFDIR
-    chmod 770 $target/$CONFDIR
-    chown root:adm $target/$CONFDIR
     echo "New config space copied to faiserver."
+fi
+chmod 770 $target/$CONFDIR
+chown root:adm $target/$CONFDIR
 
+if [ ! -d $target/$CONFDIR/.git ] ; then
     ## Use git to track modifications of the config space:
     export HOME="/root"
     $ROOTCMD git config --global user.name  root
diff --git a/fai/config/scripts/FAISERVER/40-dhcp b/fai/config/scripts/FAISERVER/40-dhcp
index c0fd4aa..0982b2e 100755
--- a/fai/config/scripts/FAISERVER/40-dhcp
+++ b/fai/config/scripts/FAISERVER/40-dhcp
@@ -2,7 +2,7 @@
 
 set -e
 
-if [ $FAI_ACTION != "install" ]; then
+if [ -e $target/etc/dhcp/dhcpd.conf_orig ]; then
     exit 0
 fi
 
diff --git a/fai/config/scripts/KDC_LDAP/10-slapd-KDC b/fai/config/scripts/KDC_LDAP/10-slapd-KDC
index d150e2d..90bf121 100755
--- a/fai/config/scripts/KDC_LDAP/10-slapd-KDC
+++ b/fai/config/scripts/KDC_LDAP/10-slapd-KDC
@@ -4,9 +4,9 @@ set -e
 
 LDIFS="/etc/ldap/root.ldif /etc/ldap/krb5.ldif /etc/ldap/autofs.ldif"
 
-## Copy files in place, but no modifications in softupdate mode:
+## Copy files in place, but no modifications if file exists:
 for file in $LDIFS /etc/ldap/slapd.conf; do
-    fcopy -U -m openldap,openldap,660 $file
+    [ -e $target/$file ] || fcopy -m openldap,openldap,660 $file
 done
 
 DN_KRB_CONT=`$ROOTCMD awk '/^dn: cn=kerberos,/ {print $2}' /etc/ldap/krb5.ldif`
diff --git a/fai/config/scripts/SERVER_A/70-dirvish b/fai/config/scripts/SERVER_A/70-dirvish
index e431bd0..eeecab4 100755
--- a/fai/config/scripts/SERVER_A/70-dirvish
+++ b/fai/config/scripts/SERVER_A/70-dirvish
@@ -40,17 +40,18 @@ expire-rule:
 EOF
 
 
-## Do the following only once when installing,
-## as /backup might not be mounted in general:
-if [ $FAI_ACTION == "install" ] ; then
+## Do the following only when $BACKUP_DIR is mounted (if needed):
+if ! grep -q "${BACKUP_DIR%/}" $target/etc/fstab || \
+    mount | grep -q "${BACKUP_DIR%/}" ; 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."
-	mkdir -v -p  $target/$BACKUP_DIR/$ID/dirvish/
-	chmod 750 $target/$BACKUP_DIR/$ID
-	cat >     $target/$BACKUP_DIR/$ID/dirvish/default.conf <<EOF
+	if [ ! -f $target/$BACKUP_DIR/$ID/dirvish/default.conf ] ; then
+	    echo "Creating dirvish config $ID for $DIR."
+	    mkdir -v -p  $target/$BACKUP_DIR/$ID/dirvish/
+	    chmod 750 $target/$BACKUP_DIR/$ID
+	    cat >     $target/$BACKUP_DIR/$ID/dirvish/default.conf <<EOF
 client: $HOSTNAME
 tree: $DIR
 xdev: 1
@@ -59,8 +60,9 @@ image-default: %Y%m%d
 exclude:
 *.bak
 EOF
-	echo "Initialize dirvish vault $ID for $DIR:"
-	$ROOTCMD dirvish --vault $ID --init
+	    echo "Initialize dirvish vault $ID for $DIR:"
+	    $ROOTCMD dirvish --vault $ID --init
+	fi
     done
     ## do not mount backup partition on boot (noauto):
     sed -i "s#\(.\+${BACKUP_DIR%/}.\+\)defaults\(.\+\)#\1noauto\2#" $target/etc/fstab

-- 
Debian-LAN development and packaging



More information about the debian-lan-devel mailing list