From d64cfa4e8bd07c0d4ff41c6d8d04f16f0a8f5508 Mon Sep 17 00:00:00 2001 From: Patrick Marchand Date: Thu, 22 Nov 2018 16:28:24 +0100 Subject: [PATCH] Fix problems with web-add.sh add-alias All uses of the VHOST_PATH variable in the code append a slash to it, so it is easier to remove the trailing slash in it's instantiation. Also simplifies the sed(1) invocation. --- scripts/web-add.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/web-add.sh b/scripts/web-add.sh index 10444a3..2dc2ff5 100755 --- a/scripts/web-add.sh +++ b/scripts/web-add.sh @@ -26,7 +26,7 @@ SSH_GROUP="evolinux-ssh" # Set to nginx if you use nginx and not apache WEB_SERVER="apache" if [ "$WEB_SERVER" == "apache" ]; then - VHOST_PATH="/etc/apache2/sites-available/" + VHOST_PATH="/etc/apache2/sites-available" TPL_VHOST="$SCRIPTS_PATH/vhost" TPL_MAIL="$SCRIPTS_PATH/web-mail.tpl" @@ -767,7 +767,7 @@ op_aliasadd() { vhost="${1}.conf" alias=$2 - [ -f $VHOST_PATH/"$vhost" ] && sed -i -e "s/\\(ServerName .*\\)/\\1\\n\\tServerAlias $alias/" "$VHOST_PATH"/"$vhost" --follow-symlinks + [ -f $VHOST_PATH/"$vhost" ] && sed -i "/ServerName .*/a \\\tServerAlias $alias" "$VHOST_PATH"/"$vhost" --follow-symlinks apache2ctl configtest 2>/dev/null /etc/init.d/apache2 force-reload >/dev/null