#! /bin/sh #---------------------------------------------------------------------------- # /tmp/preinstall.sh - preinstall mailman # # Copyright (c) 2008 the eisfair team, team(at)eisfair(dot)org # # Creation: 26.07.2004 om # Last Update: $Id$ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- mailmanfile=/etc/config.d/mailman installfile=/var/run/mailman.install mailman_deinstallfile=/var/install/deinstall/mailman VAR_PREFIX=/var/mailman PREFIX=/usr/local/mailman set +x . /var/install/include/eislib echo echo mecho -warn "running preinstall.sh of Mailman..." echo echo remove_old_version () { # Stopping mailman if available if [ -f /etc/init.d/mailman ] then /etc/init.d/mailman stop echo "mailman stopped" fi mecho -info "deinstalling old version" # rm -f -v -r /etc/config.d/mailman rm -f -v -r /etc/config.d/mailman.backup rm -f -v -r /etc/init.d/mailman rm -f -v -r /etc/default.d/mailman rm -f -v -r /etc/rc2.d/K12mailman rm -f -v -r /etc/rc2.d/S88mailman rm -f -v -r /usr/local/mailman # blos net loeschen, sonst sind die vorhandenen Mailinglisten weg! # rm -f -v -r /var/mailman rm -f -v -r /usr/share/doc/mailman rm -f -v -r /var/install/config.d/mailman.sh rm -f -v -r /var/install/config.d/httpd.conf.mailman.sh rm -f -v -r /var/install/bin/mailman-* rm -f -v -r /var/install/bin/setup.services.mailman rm -f -v -r /var/install/form/mailman rm -f -v -r /var/install/help/mailman rm -f -v -r /var/install/menu/setup.services.mailman.menu rm -f -v -r /var/www/icons/PythonPowered.png rm -f -v -r /var/www/icons/gnu-head-tiny.jpg rm -f -v -r /var/www/icons/mailman.jpg rm -f -v -r /var/www/icons/mailman-large.jpg rm -f -v -r /var/www/icons/mm-icon.png # Last, but not least! rm -f -v -r /var/install/packages/mailman rm -f -v -r /var/install/deinstall/mailman } check_versions () { echo mecho -info "Checking versions on related packages" echo installed_version=`/var/install/bin/check-version base 1.0.5` case installed_version in not-installed|new ) # wrong version mecho -warn "required base package v1.0.5 not installed - installation aborted." /var/install/bin/anykey exit 1 ;; * ) # installed / old echo "base... OK!" ;; esac # check -mail version installed_version=`/var/install/bin/check-version mail 1.3.0` case installed_version in not-installed|new ) # new - installed version older than 1.3.0 mecho -warn "required mail package v1.3.0 not installed - installation aborted." /var/install/bin/anykey exit 1 ;; * ) # not-installed / installed / old echo "Mail... OK!" ;; esac # check -python version installed_version=`/var/install/bin/check-version python 0.1.0` case installed_version in not-installed|new ) # new - installed version older than 0.1.0 mecho -warn "required python package not installed - installation aborted." /var/install/bin/anykey exit 1 ;; * ) # not-installed / installed / old echo "Python... OK!" ;; esac # check -apache version installed_version=`/var/install/bin/check-version apache 1.1.70` case $installed_version in not-installed ) echo "Apache1... missing " apache1=0 ;; * ) # new / installed / old echo "Apache1... OK!" apache1=1 ;; esac # check -apache version installed_version=`/var/install/bin/check-version apache2 0.0.96` case $installed_version in not-installed ) echo "Apache2... missing" apache2=0 ;; * ) # new / installed / old echo "Apache2... OK!" apache2=1 ;; esac if [ $apache1 -eq 0 -a $apache2 -eq 0 ] then echo mecho -warn "No Apache found!" echo "Press (1) to install Apache 1 or (2) for Apache2" echo "or any other key to stop installing" read $choice case $choice in 1) /var/install/bin/install-package http://download.eisfair.org/packages/apache.tar.gz.info ;; 2) /var/install/bin/install-package http://download.eisfair.org/packages/dev/web/apache2.tar.gz.info ;; *) echo "Any Apache webserver is required. Please start the setup of mailman again after installing the web server." exit 1 ;; esac fi } admin_stuff () { # mailman user and group echo echo "adding users and groups ..." grep '^mailman:' /etc/passwd >/dev/null if [ $? -ne 0 ] then echo "Adding user mailman..." /var/install/bin/add-user mailman '' '' 65534 "Mailman Daemon User" "" /bin/false else echo "User mailman exists" fi grep '^nogroup:' /etc/group >/dev/null if [ $? -ne 0 ] then echo "Adding group mailman..." /var/install/bin/add-group nogroup else echo "Group mailman exists" fi # Ordner anlegen und Zugriffsrechte setzen # hier: Programmpfad if [ ! -d $PREFIX ] then echo "Ordner anlegen: $PREFIX" mkdir $PREFIX chmod 2775 $PREFIX chown mailman $PREFIX fi # hier: var-Pfad if [ ! -d $VAR_PREFIX ] then echo "Ordner anlegen: $VAR_PREFIX" mkdir $VAR_PREFIX chmod 2775 $VAR_PREFIX chown mailman $VAR_PREFIX fi } remove_old_version check_versions admin_stuff exit 0