[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

less hard coded config files



On Tue, Jun 14, 2005 at 07:29:59PM +0200, Knut Yrvin wrote:
 <snip/>
> 8 new persons was tending the gathering. 5 of them would contribute to
> the next version. There came 3 new translators. Many had considerable
> experience with Linux, and was quick to catch up. We focused on the
> next version of Skolelinux to get the config-files at the right place,
> and choose the right strategy. A lot of translation and quality
> insurance were also done.

That reminds me to discus ( exchange opinions ) about less hard coded
configuration files.

There are a lot  'skolelinux.no' and 'dc=skolelinux,dc=no' strings
in the config files.

Another strange thing ( in the vision of an administrator who has seen
many other Unix / Linux systems ) are the symbolic links to debian-edu
files. Such as /etc/ldap/slapd.conf pointing to /etc/ldap/slapd-debian-edu.conf

But back to hard coded skolelinux strings.

What I would like to see is a construction that uses  .in files,
same idea as autoconf does. Have a look at this unified diff:

--- root.ldif   2004-05-25 20:58:38.000000000 +0200
+++ root.ldif.in        2005-06-19 19:00:18.000000000 +0200
@@ -1,16 +1,16 @@
-dn: dc=skole,dc=skolelinux,dc=no
+dn: $BASEDN
 objectClass: top
 objectClass: dcObject
-dc: skole
+dc: $DC
 objectClass: organization
-o: skole.skolelinux.no
+o: $FDN

-dn: ou=Attic,dc=skole,dc=skolelinux,dc=no
+dn: ou=Attic,$BASEDN
 objectClass: top
 objectClass: organizationalUnit
 ou: Attic

-dn: ou=Machines,ou=People,dc=skole,dc=skolelinux,dc=no
+dn: ou=Machines,ou=People,$BASEDN
 objectClass: top
 objectClass: organizationalUnit
 ou: Machines
@@ -53,7 +53,7 @@
 description: LDAP Administrator
 userPassword: {crypt}$ROOTPW

-dn: cn=admins,ou=Group,dc=skole,dc=skolelinux,dc=no
+dn: cn=admins,ou=Group,$BASEDN
 objectClass: top
 objectClass: posixGroup
 objectClass: lisGroup


"root.ldif" is from current package debian-edu-config,
and "root.ldif.in" from requested package debian-edu-config.


This will effect the ldap-install script like

--- /usr/bin/ldap-debian-edu-install.0.397      2004-06-30
17:06:47.000000000 +0200
+++ /usr/bin/ldap-debian-edu-install    2005-06-19 19:33:47.000000000
+0200
@@ -10,16 +10,23 @@
   exit 9
 fi

+BASEDN=$( debconf code to be build )
+DC=$( debconf code to be build )
+DOMAIN=$(  debconf code to be build )
+
 # Init tree
 init_ldap () {
   rm -f /var/lib/ldap/*
   for ldif in \
-    /etc/ldap/root.ldif \
-    /etc/ldap/netgroup.ldif \
-    /etc/ldap/autofs.ldif
+    /etc/ldap/root.ldif.in \
+    /etc/ldap/netgroup.ldif.in \
+    /etc/ldap/autofs.ldif.in
   do
       if (PW=`cat /etc/shadow | grep ^root \
              | cut -d':' -f2`; sed s:\$ROOTPW:$PW:) < $ldif \
+            | sed s:\$BASEDN:$BASEDN: \
+            | sed s:\$DC:$DC: \
+            | sed s:\$DOMAIN:$DOMAIN: \
           | /usr/sbin/slapadd
       then
           :
@@ -37,7 +44,7 @@
 /etc/init.d/slapd stop

 if slapcat \
-  |grep 'dn: cn=all-hosts,ou=Netgroup,dc=skole,dc=skolelinux,dc=no' \
+  |grep "dn: cn=all-hosts,ou=Netgroup,${BASEDN}" \
   >/dev/null 2>&1
 then
   echo "Found existing data: skiping initalization"




What are the opinions about this idea?


Cheers
Geert Stappers

Attachment: signature.asc
Description: Digital signature


Reply to: