2 # postinst script for citadel-server
7 . /usr/share/debconf/confmodule
19 chown -R citadel:citadel /etc/citadel
20 chown -R citadel:citadel /var/lib/citadel /var/spool/citadel
21 move_file /var/run/refcount_adjustments.dat /etc/citadel/data/refcount_adjustments.dat
22 move_file /etc/citadel/citadel.control /var/lib/citadel/data/citadel.control
23 move_file /etc/citadel/citadel.config /var/lib/citadel/data/citadel.config
25 db_get citadel/Administrator && admin="$RET"
26 db_get citadel/ServerIPAddress && ip_addr="$RET"
27 db_get citadel/LoginType && deb_enable_unix_auth="$RET"
29 if test "$deb_enable_unix_auth" = "true"; then
30 export ENABLE_UNIX_AUTH=yes
32 export ENABLE_UNIX_AUTH=no
35 export IP_ADDR=$ip_addr
36 export CITADEL='/var/run/citadel'
37 export CITADEL_PORT=504
38 export CITADEL_INSTALLER=yes
39 export CITADEL_UID=`grep citadel /etc/passwd | cut -d : -f 3`
41 export SYSADMIN_NAME=$admin
42 export CREATE_XINETD_ENTRY=no
43 export CREATE_INITTAB_ENTRY=no
44 export NO_INIT_SCRIPTS=yes
46 #This is not debian conformant, and uniq to the citadel.org debs.
47 export ALTER_ETC_SERVICES=yes
49 if test -S /var/run/citadel/citadel.socket; then
50 /usr/sbin/sendcommand "DOWN"
52 while test -S /var/run/citadel/citadel.socket; do
55 if test ! -f /var/lib/citadel/data/citadel.control -a -f /etc/citadel/citadel.control; then
56 mv /etc/citadel/citadel.control /var/lib/citadel/data/
57 mv /etc/citadel/citadel.config /var/lib/citadel/data/
60 echo -n "applying your settings.... "
61 /usr/lib/citadel-server/setup -q
63 # we're in a fresh install, so we send the welcome message.
65 echo "migrating mail aliases from other mailers"
66 /usr/lib/citadel-server/migrate_aliases.sh /etc/citadel/mail.aliases
68 while test ! -S /var/run/citadel/lmtp.socket -a "$i" -lt "10"; do
72 if test -S /var/run/citadel/lmtp.socket ; then
73 echo "sending welcome mail"
74 export SEPERATOR=2600908b3f21ae7f692b973ed26e212d
75 export WELCOMEHTML=/usr/share/doc/citadel-server/welcomemail.html
76 export WELCOMETXT=/usr/share/doc/citadel-server/welcomemail.txt
77 export FROM=room_citadel_stats@uncensored.citadel.org
80 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";
82 printf "\r\n\r\n--$SEPERATOR\r\nContent-Type: text/html; charset=US-ASCII\r\nContent-Transfer-Encoding: quoted-printable\r\n\r\n"
84 printf "\r\n\r\n--$SEPERATOR--\r\n\r\n") | \
85 /usr/sbin/citmail -bm -r "$FROM" "$TO"
89 if test -S /var/run/citadel/citadel.socket; then
90 /usr/sbin/sendcommand "DOWN"
93 while test -S /var/run/citadel/citadel.socket; do
100 abort-upgrade|abort-remove|abort-deconfigure)
104 echo "postinst called with unknown argument \`$1'" >&2