| 1 | #!/bin/sh -e |
|---|
| 2 | |
|---|
| 3 | # Cette fonction regarde si un fichier de config ($1) a déjà reçu une modif |
|---|
| 4 | # de config, et sinon, lui ajoute la ligne voulue là où la balise le demande. |
|---|
| 5 | function configure { |
|---|
| 6 | if grep -vqs "\*\*\*MAILMAN\*\*\*" $1 |
|---|
| 7 | then |
|---|
| 8 | # 1. on déplace le fichier |
|---|
| 9 | rm -f $1.alternc_mailman |
|---|
| 10 | sed -e "s/\*\*\*ALTERNC_ALIASES\*\*\*/&\\ |
|---|
| 11 | # ***MAILMAN*** \\ |
|---|
| 12 | Alias \/marchives\/ \/var\/lib\/mailman\/archives\/public\/ \\ |
|---|
| 13 | Alias \/mimages\/ \/usr\/share\/images\/mailman\//" <$1 >$1.alternc_mailman |
|---|
| 14 | mv -f $1.alternc_mailman $1 |
|---|
| 15 | fi |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | if [ "$1" = "configure" ] |
|---|
| 21 | then |
|---|
| 22 | QUIT=0 |
|---|
| 23 | # is "AlternC" package properly installed ? |
|---|
| 24 | if [ -f /etc/alternc/alternc.conf ] |
|---|
| 25 | then |
|---|
| 26 | # is Alternc package properly CONFIGURED by the user ? |
|---|
| 27 | (grep "^exit" /etc/alternc/alternc.conf) || (QUIT=1) |
|---|
| 28 | else |
|---|
| 29 | QUIT=1 |
|---|
| 30 | fi |
|---|
| 31 | if [ ! -x /etc/alternc/local.sh ] |
|---|
| 32 | then |
|---|
| 33 | QUIT=1 |
|---|
| 34 | fi |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | if [ $QUIT -eq 0 ] |
|---|
| 38 | then |
|---|
| 39 | # Oui : on peut créer la table mailman tout de suite |
|---|
| 40 | . /etc/alternc/local.sh |
|---|
| 41 | echo "Installing mysql table" |
|---|
| 42 | mysql -u"$MYSQL_USER" -p"$MYSQL_PASS" "$MYSQL_DATABASE" </usr/share/alternc/1.0/install/mailman.sql || true |
|---|
| 43 | # on modifie le httpd.conf d'apache et d'apache-ssl (déjà installés) |
|---|
| 44 | echo "Configuring apache" |
|---|
| 45 | configure /etc/apache/httpd.conf |
|---|
| 46 | echo "Configuring apache-ssl" |
|---|
| 47 | configure /etc/apache-ssl/httpd.conf |
|---|
| 48 | echo "Configuration AlternC" |
|---|
| 49 | # On modifie /usr/share/alternc/1.0/install/etc/apache et apache-ssl |
|---|
| 50 | # uniquement si besoin. |
|---|
| 51 | configure /usr/share/alternc/1.0/install/etc/apache/httpd.conf |
|---|
| 52 | configure /usr/share/alternc/1.0/install/etc/apache-ssl/httpd.conf |
|---|
| 53 | # On crée le fichier mm_cfg.py dans /etc/mailman : |
|---|
| 54 | echo "Création du fichier de config mailman" |
|---|
| 55 | . /etc/alternc/alternc.conf |
|---|
| 56 | sed -e "s/%%fqdn%%/$fqdn/" </usr/share/alternc/1.0/install/etc/mailman/mm_cfg.py >/etc/mailman/mm_cfg.py |
|---|
| 57 | # Process the language compilation. |
|---|
| 58 | /usr/share/alternc/install/dopo.sh |
|---|
| 59 | ln -sf /usr/lib/cgi-bin/mailman /var/alternc/cgi-bin/mailman |
|---|
| 60 | # ADD Mailman menu item : |
|---|
| 61 | MENUFILE=/var/alternc/bureau/admin/menulist.txt |
|---|
| 62 | if grep -vqs "menu_mailman" $MENUFILE |
|---|
| 63 | then |
|---|
| 64 | rm -f $MENUFILE.alternc_mailman |
|---|
| 65 | sed -e "s/menu_ftp.php/&\\ |
|---|
| 66 | menu_mailman.php/" <$MENUFILE >$MENUFILE.alternc_mailman |
|---|
| 67 | mv -f $MENUFILE.alternc_mailman $MENUFILE |
|---|
| 68 | fi |
|---|
| 69 | # Set nonexec on list creation / deletion via cgi-bin |
|---|
| 70 | chmod 0 /usr/lib/cgi-bin/mailman/create /usr/lib/cgi-bin/mailman/rmlist || true |
|---|
| 71 | /etc/init.d/apache restart |
|---|
| 72 | /etc/init.d/apache-ssl restart |
|---|
| 73 | else |
|---|
| 74 | # Source debconf library. |
|---|
| 75 | . /usr/share/debconf/confmodule |
|---|
| 76 | db_version 2.0 |
|---|
| 77 | db_title AlternC-Mailman |
|---|
| 78 | db_fset alternc-mailman/errorinstall seen false |
|---|
| 79 | db_input medium alternc-mailman/errorinstall |
|---|
| 80 | db_go |
|---|
| 81 | # il FAUT qu'AlternC soit proprement configuré pour installer mailman |
|---|
| 82 | exit 1 |
|---|
| 83 | fi |
|---|
| 84 | fi |
|---|
| 85 | |
|---|
| 86 | # dh_installdeb will replace this with shell code automatically |
|---|
| 87 | # generated by other debhelper scripts. |
|---|
| 88 | #DEBHELPER# |
|---|