- Add needed debian package 'libmail-sendmail-perl'.

- Redisign support for Systemd.
This commit is contained in:
Christoph 2018-01-15 04:21:05 +01:00
parent 6cfbf00f0f
commit 33ee41f631

View File

@ -61,6 +61,7 @@ _required_debian_packages="
libio-socket-ssl-perl libio-socket-ssl-perl
libsoap-lite-perl libsoap-lite-perl
libcrypt-ciphersaber-perl libcrypt-ciphersaber-perl
libmail-sendmail-perl
libmail-dkim-perl libmail-dkim-perl
cpanminus cpanminus
" "
@ -198,10 +199,12 @@ trap clean_up SIGHUP SIGINT SIGTERM
# - Support systemd ? # - Support systemd ?
# - # -
if [[ "X$(which systemd)" = "X" ]]; then _systemd="$(which systemd)"
SYSTEMD_EXISTS=false _systemctl="$(which systemctl)"
if [[ -z "$_systemd" ]] && [[ -z "$_systemctl" ]]; then
SYSTEMD_SUPPORTED=false
else else
SYSTEMD_EXISTS=true SYSTEMD_SUPPORTED=true
fi fi
@ -273,12 +276,31 @@ fi
APACHE_INIT_SCRIPT="" APACHE_INIT_SCRIPT=""
if [ -x "/etc/init.d/apache2" ]; then APACHE_SERVICE_FILE=""
if $SYSTEMD_SUPPORTED ; then
# - Is Service exclusive controlled by systemd
# -
if systemctl -t service list-unit-files \
| grep -e "^mysql" \
| grep -q enabled 2> /devnull ; then
APACHE_SERVICE_FILE=$(systemctl -t service list-unit-files \
| grep -e "^apache" \
| awk '{print$1}')
fi
fi
if [[ -z "$APACHE_SERVICE_FILE" ]] ; then
if [ -x "$(realpath /etc/init.d/apache2)" ]; then
APACHE_INIT_SCRIPT="/etc/init.d/apache2" APACHE_INIT_SCRIPT="/etc/init.d/apache2"
elif [ -x "/etc/init.d/apachectl" ]; then elif [ -x "$(realpath /etc/init.d/apachectl)" ]; then
APACHE_INIT_SCRIPT="/etc/init.d/apachectl" APACHE_INIT_SCRIPT="/etc/init.d/apachectl"
else fi
fatal 'Cannot find init-script for Apache web server!' fi
if [[ -z "$APACHE_INIT_SCRIPT" ]] && [[ -z $APACHE_SERVICE_FILE ]]; then
fatal 'Neither an init-script nor a service file for apache2 found!'
fi fi
@ -1187,7 +1209,7 @@ while [ "X$OK" != "Xyes" -a "X$OK" != "Xno" ]; do
OK=`echo "$OK" | tr '[:upper:]' '[:lower:]'` OK=`echo "$OK" | tr '[:upper:]' '[:lower:]'`
done done
if [ "$OK" = "yes" ]; then if [ "$OK" = "yes" ]; then
SYSTEMD_EXISTS=false SYSTEMD_SUPPORTED=false
fi fi
if $UPDATE_SYMPA ;then if $UPDATE_SYMPA ;then
@ -1245,7 +1267,7 @@ if ! $UPDATE_SYMPA ; then
fi fi
echo "Directory for init scripts......: $SYMPA_INIT_DIR" echo "Directory for init scripts......: $SYMPA_INIT_DIR"
echo "" echo ""
echo "Use systemd.....................: $SYSTEMD_EXISTS" echo "Use systemd.....................: $SYSTEMD_SUPPORTED"
if ! $UPDATE_SYMPA ; then if ! $UPDATE_SYMPA ; then
echo "" echo ""
echo "Apache VHost directory..........: $apache_vhost_dir" echo "Apache VHost directory..........: $apache_vhost_dir"
@ -1366,7 +1388,7 @@ if ! $UPDATE_SYMPA ; then
fi fi
echo "## - Directory for init scripts........: $SYMPA_INIT_DIR" >> $_log_file echo "## - Directory for init scripts........: $SYMPA_INIT_DIR" >> $_log_file
echo "## -" >> $_log_file echo "## -" >> $_log_file
echo "## - Use systemd.......................: $SYSTEMD_EXISTS" >> $_log_file echo "## - Use systemd.......................: $SYSTEMD_SUPPORTED" >> $_log_file
echo "## -" >> $_log_file echo "## -" >> $_log_file
if ! $UPDATE_SYMPA ; then if ! $UPDATE_SYMPA ; then
echo "## - Apache VHost directory............: $apache_vhost_dir" >> $_log_file echo "## - Apache VHost directory............: $apache_vhost_dir" >> $_log_file
@ -1440,7 +1462,7 @@ if ! $UPDATE_SYMPA ; then
echo "POSTFIX_CONF_DIR=$POSTFIX_CONF_DIR" >> $_log_file echo "POSTFIX_CONF_DIR=$POSTFIX_CONF_DIR" >> $_log_file
fi fi
echo "" >> $_log_file echo "" >> $_log_file
echo "SYSTEMD_EXISTS=$SYSTEMD_EXISTS" >> $_log_file echo "SYSTEMD_SUPPORTED=$SYSTEMD_SUPPORTED" >> $_log_file
echo "" >> $_log_file echo "" >> $_log_file
echo "_src_base_dir=$_src_base_dir" >> $_log_file echo "_src_base_dir=$_src_base_dir" >> $_log_file
@ -1785,9 +1807,9 @@ else
echononl "\tStopping Apache Webserver .." echononl "\tStopping Apache Webserver .."
_PID=`ps aux | grep "$HTTPD " | grep -e "^root" | grep -v grep | awk '{print$2}'` _PID=`ps aux | grep "$HTTPD " | grep -e "^root" | grep -v grep | awk '{print$2}'`
if [ -n "$_PID" ];then if [ -n "$_PID" ];then
if $SYSTEMD_EXISTS ; then if $SYSTEMD_SUPPORTED ; then
echo "systemctl stop apache2" >> $_log_file echo "systemctl stop $APACHE_SERVICE_FILE" >> $_log_file
systemctl stop apache2 >> $_log_file 2>&1 systemctl stop $APACHE_SERVICE_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
echo_ok echo_ok
else else
@ -1823,7 +1845,7 @@ else
echo "" >> $_log_file echo "" >> $_log_file
echo "## - Stopping Sympa mailing list manager .." >> $_log_file echo "## - Stopping Sympa mailing list manager .." >> $_log_file
echo "## -" >> $_log_file echo "## -" >> $_log_file
if $SYSTEMD_EXISTS ; then if $SYSTEMD_SUPPORTED ; then
echo "systemctl stop sympa" >> $_log_file echo "systemctl stop sympa" >> $_log_file
systemctl stop sympa >> $_log_file 2>&1 systemctl stop sympa >> $_log_file 2>&1
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
@ -2109,7 +2131,7 @@ if $UPDATE_SYMPA ; then
error "\"${SYMPA_BIN_DIR}/sympa.pl --upgrade\" failed!" error "\"${SYMPA_BIN_DIR}/sympa.pl --upgrade\" failed!"
fi fi
if $SYSTEMD_EXISTS ; then if $SYSTEMD_SUPPORTED ; then
echononl "\tReload systemd configuration.." echononl "\tReload systemd configuration.."
echo "" >> $_log_file echo "" >> $_log_file
echo "## - Reload systemd configuration.." >> $_log_file echo "## - Reload systemd configuration.." >> $_log_file
@ -2503,7 +2525,7 @@ if ! $UPDATE_SYMPA ; then
## - Make Sympa mailing list manager start at boottime ## - Make Sympa mailing list manager start at boottime
## - ## -
if $SYSTEMD_EXISTS ; then if $SYSTEMD_SUPPORTED ; then
echo "" >> $_log_file echo "" >> $_log_file
echo "## - Eanbles sympa.service" >> $_log_file echo "## - Eanbles sympa.service" >> $_log_file
@ -2530,7 +2552,7 @@ if ! $UPDATE_SYMPA ; then
echo_failed echo_failed
error "Making sympa start at boottime failed." error "Making sympa start at boottime failed."
fi fi
fi # if $SYSTEMD_EXISTS fi # if $SYSTEMD_SUPPORTED
fi # if START_AT_BOOTTIME fi # if START_AT_BOOTTIME
fi # if $UPDATE_SYMPA fi # if $UPDATE_SYMPA
@ -3485,7 +3507,7 @@ EOF
echo "" >> $_log_file echo "" >> $_log_file
echo "## - Reload Postfix.." >> $_log_file echo "## - Reload Postfix.." >> $_log_file
echo "## -" >> $_log_file echo "## -" >> $_log_file
if $SYSTEMD_EXISTS ; then if $SYSTEMD_SUPPORTED ; then
echo "systemctl reload postfix" >> $_log_file echo "systemctl reload postfix" >> $_log_file
systemctl reload postfix >> $_log_file 2>&1 systemctl reload postfix >> $_log_file 2>&1
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
@ -3522,7 +3544,7 @@ echo "## ---" >> $_log_file
echo "## --- Starting Sympa mailing list manager .." >> $_log_file echo "## --- Starting Sympa mailing list manager .." >> $_log_file
echo "## ---" >> $_log_file echo "## ---" >> $_log_file
echo "" >> $_log_file echo "" >> $_log_file
if $SYSTEMD_EXISTS ; then if $SYSTEMD_SUPPORTED ; then
echononl "\tReload systemd configuration" echononl "\tReload systemd configuration"
echo "systemctl daemon-reload" >> $_log_file echo "systemctl daemon-reload" >> $_log_file
@ -3590,9 +3612,9 @@ if $UPDATE_SYMPA ; then
echo "" >> $_log_file echo "" >> $_log_file
echo "## - Start Apache Webserver.." >> $_log_file echo "## - Start Apache Webserver.." >> $_log_file
echo "## -" >> $_log_file echo "## -" >> $_log_file
if $SYSTEMD_EXISTS ; then if $SYSTEMD_SUPPORTED ; then
echo "systemctl start apache2" >> $_log_file echo "systemctl start $APACHE_SERVICE_FILE" >> $_log_file
systemctl start apache2 >> $_log_file 2>&1 systemctl start $APACHE_SERVICE_FILE >> $_log_file 2>&1
if [ "$?" = "0" ]; then if [ "$?" = "0" ]; then
echo_ok echo_ok
_apache_configtest=true _apache_configtest=true