Reworked the setup program to use the new config system.
[citadel.git] / citadel / debian / citadel-server.postinst
index cdb7cdfed93e69e4f0c2e0afceedc46fc49aff9e..b5227a4c2bf149b7efe2c3d15043aada8fa5f8f6 100644 (file)
@@ -21,41 +21,33 @@ case "$1" in
        move_file /var/run/refcount_adjustments.dat /etc/citadel/data/refcount_adjustments.dat
        move_file /etc/citadel/citadel.control /var/lib/citadel/data/citadel.control
        move_file /etc/citadel/citadel.config /var/lib/citadel/data/citadel.config
+       invoke-rc.d citadel start
 
-        db_get citadel/Administrator && admin="$RET"
-        db_get citadel/ServerIPAddress && ip_addr="$RET"
-        db_get citadel/LoginType && deb_enable_unix_auth="$RET"
+        db_get citadel/Administrator &&      admin="$RET"
+        db_get citadel/ServerIPAddress &&    ip_addr="$RET"
+        db_get citadel/LoginType &&          ENABLE_UNIX_AUTH="$RET"; export ENABLE_UNIX_AUTH
+        db_get citadel/LDAPServer &&         LDAP_HOST="$RET"; export LDAP_HOST
+        db_get citadel/LDAPServerPort &&     LDAP_PORT="$RET"; export LDAP_PORT
+        db_get citadel/LDAPBaseDN &&         LDAP_BASE_DN="$RET"; export LDAP_BASE_DN
+        db_get citadel/LDAPBindDN &&         LDAP_BIND_DN="$RET"; export LDAP_BIND_DN
+        db_get citadel/LDAPBindDNPassword && LDAP_BIND_PW="$RET"; export LDAP_BIND_PW
 
-        if test "$deb_enable_unix_auth" = "true"; then
-            export ENABLE_UNIX_AUTH=yes
-        else
-            export ENABLE_UNIX_AUTH=no
-        fi
 
         export IP_ADDR=$ip_addr
         export CITADEL='/var/run/citadel'
        export CITADEL_PORT=504
         export CITADEL_INSTALLER=yes
-        export CITADEL_UID=`grep citadel /etc/passwd | cut -d :  -f 3`
+       export CITADEL_UID=`grep ^citadel: /etc/passwd | cut -d :  -f 3`
         export ACT_AS_MTA=no
         export SYSADMIN_NAME=$admin
         export CREATE_XINETD_ENTRY=no
         export CREATE_INITTAB_ENTRY=no
         export NO_INIT_SCRIPTS=yes
 
-#This is not debian conformant, and uniq to the citadel.org debs.
-       export ALTER_ETC_SERVICES=yes
-#
-        if test -S /var/run/citadel/citadel.socket; then 
-            /usr/sbin/sendcommand "DOWN"
-        fi
-        while test -S /var/run/citadel/citadel.socket; do 
-            sleep 1
-        done
-       if test ! -f /var/lib/citadel/data/citadel.control -a -f /etc/citadel/citadel.control; then
-           mv /etc/citadel/citadel.control /var/lib/citadel/data/
-           mv /etc/citadel/citadel.config /var/lib/citadel/data/
-       fi
+       while test ! -S /var/run/citadel/citadel-admin.socket; do
+               sleep 1
+               echo -n :
+       done
 
         echo -n "applying your settings.... "
         /usr/lib/citadel-server/setup -q
@@ -74,7 +66,7 @@ case "$1" in
                export SEPERATOR=2600908b3f21ae7f692b973ed26e212d
                export WELCOMEHTML=/usr/share/doc/citadel-server/welcomemail.html
                export WELCOMETXT=/usr/share/doc/citadel-server/welcomemail.txt
-               export FROM=room_citadel_stats@uncensored.citadel.org
+               export FROM=nobody@example.com
                export TO=room_lobby
                (
                     printf "MIME-Version: 1.0\r\nContent-Type: multipart/alternative; \r\n boundary=$SEPERATOR\r\n\r\nThis is a multi-part message in MIME format.\r\n\r\n--$SEPERATOR\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n"; 
@@ -86,14 +78,6 @@ case "$1" in
             fi
        fi
 
-        if test -S /var/run/citadel/citadel.socket; then 
-            /usr/sbin/sendcommand "DOWN"
-        fi
-
-        while test -S /var/run/citadel/citadel.socket; do 
-            sleep 1
-        done
-
         db_stop
     ;;