Changeset 1237 for trunk/debian/postinst
- Timestamp:
- 03/11/06 16:09:50 (7 years ago)
- File:
-
- 1 edited
-
trunk/debian/postinst (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/debian/postinst
r1219 r1237 1 #!/bin/sh -e1 #!/bin/sh 2 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. 3 set -e 4 5 CONFIGFILE="/etc/alternc/local.sh" 6 MENUFILE="/etc/alternc/menulist.txt" 7 MAILMAN_SCRIPT="/var/lib/mailman/mail/mailman" 8 MAILMAN_CONFIG="/etc/mailman/mm_cfg.py" 9 MAILMAN_CONFIG_TEMPLATE="/etc/alternc/templates/mailman/mm_cfg.py" 10 MAILMAN_CONFIG_BACKUP="/var/backups/alternc/etc-mailman-mm_cfg.py" 11 MAILMAN_SCRIPT="/var/lib/mailman/mail/mailman" 12 13 # Add mailman aliases to the apache configuration file given as argument 5 14 function configure { 6 if grep -vqs "\*\*\*MAILMAN\*\*\*" $1 7 then 8 # 1. on déplace le fichier 9 rm -f $1.alternc_mailman 15 if ! grep -Eq "\*\*\*MAILMAN\*\*\*" $1; then 16 cp -a -f $1.tmp 10 17 sed -e "s/\*\*\*ALTERNC_ALIASES\*\*\*/&\\ 11 18 # ***MAILMAN*** \\ 12 19 Alias \/marchives\/ \/var\/lib\/mailman\/archives\/public\/ \\ 13 Alias \/mimages\/ \/usr\/share\/images\/mailman\//" < $1 >$1.alternc_mailman14 mv -f $1. alternc_mailman$120 Alias \/mimages\/ \/usr\/share\/images\/mailman\//" < $1 > $1.tmp 21 mv -f $1.tmp $1 15 22 fi 16 23 } 17 24 18 25 26 case "$1" in 27 configure) 28 . "$CONFIGFILE" 19 29 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 echo "Installing mysql table" 31 mysql -u"$MYSQL_USER" -p"$MYSQL_PASS" -h"$MYSQL_HOST" "$MYSQL_DATABASE" \ 32 < /usr/share/alternc/install/mailman.sql 33 34 # Install generated mailman configuration if it has not been modified since 35 # last package configuration 36 if [ -f "$MAILMAN_CONFIG_BACKUP" ]; then 37 if ! diff -q "$MAILMAN_CONFIG" "$MAILMAN_CONFIG_BACKUP"; then 38 echo "$MAILMAN_CONFIG has been modified since last alternc-mailman" 39 echo "configuration. You should merge your changes to" 40 echo "$MAILMAN_CONFIG_TEMPLATE and delete $MAILMAN_CONFIG_BACKUP" 41 exit 1 42 fi 30 43 fi 31 if [ ! -f /etc/alternc/local.sh ] 32 then 33 QUIT=1 44 sed -e "s/%%fqdn%%/$FQDN/" < "$MAILMAN_CONFIG_TEMPLATE" > "$MAILMAN_CONFIG" 45 cp -a -f "$MAILMAN_CONFIG" "$MAILMAN_CONFIG_BACKUP" 46 47 # Create the "mailman" list if it does not exist yet 48 if [ ! -d /var/lib/mailman/lists/mailman ]; then 49 /var/lib/mailman/bin/newlist -q mailman "root@$FQDN" "$MYSQL_PASS" 50 ( echo "INSERT INTO mailman 51 VALUES (NULL, 2000, 'mailman', '${FQDN}', 'mailman');" 52 echo "INSERT INTO mail_domain 53 VALUES ('${user}@${FQDN}', '${user}_${FQDN}', 2000, 0, 1);" 54 echo "INSERT INTO mail_alias 55 VALUES ('${user}_${FQDN}', 56 '\"| $MAILMAN_SCRIPT post mailman\"');" 57 for kind in request owner admin bounces confirm join \ 58 leave subscribe unsubscribe; do 59 echo "INSERT INTO mail_domain 60 VALUES ('mailman-${kind}@${FQDN}', 61 'mailman-${kind}_${FQDN}', 2000, 0, 1);" 62 echo "INSERT INTO mail_alias 63 VALUES ('mailman-${kind}_${FQDN}', 64 '\"| $MAILMAN_SCRIPT ${kind} mailman\"');" 65 done 66 ) | mysql -f -u"$MYSQL_USER" -p"$MYSQL_PASS" -h"$MYSQL_HOST" \ 67 "$MYSQL_DATABASE" || true 34 68 fi 35 69 70 # Refresh apache configuration 71 configure /etc/alternc/templates/apache/httpd.conf 72 configure /etc/alternc/templates/apache-ssl/httpd.conf 73 ln -sf /usr/lib/cgi-bin/mailman /var/alternc/cgi-bin/mailman 74 alternc.install 36 75 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" -h"$MYSQL_HOST" "$MYSQL_DATABASE" </usr/share/alternc/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/install/etc/apache et apache-ssl 50 # uniquement si besoin. 51 configure /usr/share/alternc/install/etc/apache/httpd.conf 52 configure /usr/share/alternc/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 sed -e "s/%%fqdn%%/$FQDN/" </usr/share/alternc/install/etc/mailman/mm_cfg.py >/etc/mailman/mm_cfg.py 56 # Process the language compilation. 57 /usr/share/alternc/install/dopo.sh 58 ln -sf /usr/lib/cgi-bin/mailman /var/alternc/cgi-bin/mailman 59 # ADD Mailman menu item : 60 MENUFILE=/var/alternc/bureau/admin/menulist.txt 61 if grep -vqs "menu_mailman" $MENUFILE 62 then 63 rm -f $MENUFILE.alternc_mailman 64 sed -e "s/menu_ftp.php/&\\ 76 # Process the language compilation. 77 /usr/share/alternc/install/dopo.sh 78 79 # ADD Mailman menu item : 80 if ! grep -q "^menu_mailman.php$" "$MENUFILE"; then 81 rm -f $MENUFILE.alternc_mailman 82 sed -e "s/menu_ftp.php/&\\ 65 83 menu_mailman.php/" <$MENUFILE >$MENUFILE.alternc_mailman 66 mv -f $MENUFILE.alternc_mailman $MENUFILE 67 fi 68 # Set nonexec on list creation / deletion via cgi-bin 69 chmod 0 /usr/lib/cgi-bin/mailman/create /usr/lib/cgi-bin/mailman/rmlist || true 70 /etc/init.d/apache restart 71 /etc/init.d/apache-ssl restart 72 else 73 # Source debconf library. 74 . /usr/share/debconf/confmodule 75 db_version 2.0 76 db_title AlternC-Mailman 77 db_fset alternc-mailman/errorinstall seen false 78 db_input medium alternc-mailman/errorinstall 79 db_go 80 # il FAUT qu'AlternC soit proprement configuré pour installer mailman 81 exit 1 84 mv -f $MENUFILE.alternc_mailman $MENUFILE 82 85 fi 83 fi 86 ;; 87 88 abort-upgrade|abort-remove|abort-deconfigure) 89 ;; 90 91 *) 92 echo "postinst called with unknown argument \`$1'" >&2 93 exit 1 94 ;; 95 esac 84 96 85 97 # dh_installdeb will replace this with shell code automatically 86 98 # generated by other debhelper scripts. 87 99 #DEBHELPER# 100 101 # vim: et sw=4
Note: See TracChangeset
for help on using the changeset viewer.
