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

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


The following commit has been merged in the squeeze branch:
commit 35ae3104a2dbb697720a1e540d12df162452ad32
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 4ce415b..4a85208 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 $target/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 $target/etc/bind/named.conf.local "include \"/etc/bind/localzones\";"
+
 cat > $target/etc/bind/localzones <<EOF
 zone "${PREFIX2}.${PREFIX1}.in-addr.arpa" {
         type master;
@@ -96,6 +96,7 @@ ltsp                    CNAME   mainserver.intern.
 domain                  CNAME   mainserver.intern.
 ldap                    CNAME   mainserver.intern.
 kerberos                CNAME   mainserver.intern.
+mail                    CNAME   mainserver.intern.
 postoffice              CNAME   mainserver.intern.
 syslog                  CNAME   mainserver.intern.
 faiserver               CNAME   mainserver.intern.
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 a08b505..20135fa 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