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