diff -Nur -x '*.orig' -x '*.rej' e-smith-ldap-5.2.0/root/var/service/ldap/run mezzanine_patched_e-smith-ldap-5.2.0/root/var/service/ldap/run
--- e-smith-ldap-5.2.0/root/var/service/ldap/run	2010-12-01 17:05:06.000000000 +0100
+++ mezzanine_patched_e-smith-ldap-5.2.0/root/var/service/ldap/run	2010-12-01 17:03:20.000000000 +0100
@@ -11,7 +11,6 @@
 
 if [ -n "$old_domain" ]
 then
-    old_domain=$(basename $old_domain | sed s/.ldif//)
     old_ldif="/home/e-smith/db/ldap/$old_domain.ldif"
 fi
 
@@ -38,23 +37,20 @@
 
 /sbin/e-smith/expand-template /var/lib/ldap/DB_CONFIG
 
-# If the ldif dump is empty it's sme8beta: init ldap
-[ -s "$ldif" ] || rm -f /var/lib/ldap/id2entry.bdb
-
 # Prime directory if required
 if [ \! -f /var/lib/ldap/id2entry.bdb ]
 then
     if [ -e "$old_ldif" ]
     then
-        grep -q "objectClass: dcObject" "$ldif" || /sbin/e-smith/expand-template /home/e-smith/db/ldap/ldif
         perl ./convert_ldif -i - -o - < $old_ldif | \
             setuidgid ldap slapadd -c
     else
         if [ \! -e "$ldif" ]
         then
-            /sbin/e-smith/expand-template /home/e-smith/db/ldap/ldif
+            touch $ldif
         fi
-        setuidgid ldap slapadd -c < $ldif
+        perl ./convert_ldif -i - -o - < $ldif | \
+            setuidgid ldap slapadd -c
     fi
 fi
 
