X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fdebian%2Fcitadel-server.postinst;h=b07a655f510f3b1ee2325b94d1c579d5358104c9;hb=a2ae8dfea31fc1495e3a97b28f3ddca01f491bef;hp=17bbfa4e4dfc88ff28403538edcdd2b0d24c878b;hpb=7210db35078fe2c44f4800b36ad04276d3a3ede3;p=citadel.git diff --git a/citadel/debian/citadel-server.postinst b/citadel/debian/citadel-server.postinst index 17bbfa4e4..b07a655f5 100644 --- a/citadel/debian/citadel-server.postinst +++ b/citadel/debian/citadel-server.postinst @@ -7,61 +7,74 @@ set -e . /usr/share/debconf/confmodule db_version 2.0 +move_file() +{ + [ ! -f $1 ] && return + [ -f $2 ] && return + mv -f $1 $2 +} + case "$1" in configure) chown -R citadel:citadel /etc/citadel chown -R citadel:citadel /var/lib/citadel /var/spool/citadel + 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 - # we're a bit paranoid here, - # because of this gave us many errors in the past. - chown root:root /usr/sbin/chkpwd - chmod 4755 /usr/sbin/chkpwd - - db_get citadel/Administrator && admin="$RET" - db_get citadel/ServerIPAddress && ip_addr="$RET" - db_get citadel/LoginType && 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 "$enable_unix_auth" = "true"; then - export ENABLE_UNIX_AUTH=yes - else - export ENABLE_UNIX_AUTH=no - fi export IP_ADDR=$ip_addr - export CITADEL='' + 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 ACT_AS_MTA=no export SYSADMIN_NAME=$admin export CREATE_XINETD_ENTRY=no export CREATE_INITTAB_ENTRY=no export NO_INIT_SCRIPTS=yes - echo "applying your settings." - /usr/lib/citadel-server/setup -q + while test ! -S /var/run/citadel/citadel-admin.socket; do + sleep 1 + echo -n : + done - # we're in a fresh install, so we send the welcome message. + echo -n "applying your settings.... " + /usr/lib/citadel-server/setup -q + echo "done" + # this is a new installation if test -z "$2"; then - 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 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"; - cat $WELCOMETXT - printf "\r\n\r\n--$SEPERATOR\r\nContent-Type: text/html; charset=US-ASCII\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n" - cat $WELCOMEHTML; - printf "\r\n\r\n--$SEPERATOR--\r\n\r\n") | \ - /usr/sbin/citmail -bm -r "$FROM" "$TO" - 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 + i=0; + while test ! -S /var/run/citadel/lmtp.socket -a "$i" -lt "10"; do + sleep 1 + i=$(($i + 1)) + done + if test -S /var/run/citadel/lmtp.socket ; then + echo "sending welcome mail" + export SEPERATOR=2600908b3f21ae7f692b973ed26e212d + export WELCOMEHTML=/usr/share/doc/citadel-server/welcomemail.html + export WELCOMETXT=/usr/share/doc/citadel-server/welcomemail.txt + 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"; + cat $WELCOMETXT + printf "\r\n\r\n--$SEPERATOR\r\nContent-Type: text/html; charset=US-ASCII\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n" + cat $WELCOMEHTML; + printf "\r\n\r\n--$SEPERATOR--\r\n\r\n") | \ + /usr/sbin/citmail -bm -r "$FROM" "$TO" + fi + fi db_stop ;;