From 5b223d2ee42f955082ee0f0cd65f7a0c603a6ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Fri, 28 Oct 2016 09:44:11 +0200 Subject: [PATCH] postinstall.sh - create nginx config also for centos / sles --- README_Install_Debian_Ubuntu.md | 2 +- .../nginx/{sites-available => }/zammad.conf | 0 contrib/pkgr-postinstall.sh | 23 +++++++++++-------- 3 files changed, 14 insertions(+), 11 deletions(-) rename contrib/nginx/{sites-available => }/zammad.conf (100%) diff --git a/README_Install_Debian_Ubuntu.md b/README_Install_Debian_Ubuntu.md index 9e037dfef..03cb304c3 100644 --- a/README_Install_Debian_Ubuntu.md +++ b/README_Install_Debian_Ubuntu.md @@ -19,7 +19,7 @@ * exit ### Create Nginx Config -* cp /opt/zammad/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf +* cp /opt/zammad/contrib/nginx/zammad.conf /etc/nginx/sites-available/zammad.conf * vi /etc/nginx/sites-available/zammad.conf * change servername "localhost" to your domain if your're not testing localy * ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf diff --git a/contrib/nginx/sites-available/zammad.conf b/contrib/nginx/zammad.conf similarity index 100% rename from contrib/nginx/sites-available/zammad.conf rename to contrib/nginx/zammad.conf diff --git a/contrib/pkgr-postinstall.sh b/contrib/pkgr-postinstall.sh index b5f9e005e..ee8ad76e9 100755 --- a/contrib/pkgr-postinstall.sh +++ b/contrib/pkgr-postinstall.sh @@ -59,21 +59,24 @@ echo "# Starting Zammad" ${INIT_CMD} start zammad # nginx config -if [ -d /etc/nginx/sites-enabled ]; then +if [ -n "$(which nginx)" ];then # copy nginx config - test -f /etc/nginx/sites-available/zammad.conf || cp ${ZAMMAD_DIR}/contrib/nginx/sites-available/zammad.conf /etc/nginx/sites-available/zammad.conf - - if [ ! -f /etc/nginx/sites-available/zammad.conf ]; then - # creating symlink - ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf - - echo -e "\nAdd your FQDN to servername directive in /etc/nginx/sites/enabled/zammad.conf anmd restart nginx if you're not testing localy!\n" + # debian / ubuntu + if [ -d /etc/nginx/sites-enabled ]; then + NGINX_CONF="/etc/nginx/sites-enabled/zammad.conf" + test -f /etc/nginx/sites-available/zammad.conf || cp ${ZAMMAD_DIR}/contrib/nginx/zammad.conf /etc/nginx/sites-available/zammad.conf + test -f /etc/nginx/sites-available/zammad.conf || ln -s /etc/nginx/sites-available/zammad.conf /etc/nginx/sites-enabled/zammad.conf + # centos / sles + elif [ -d /etc/nginx/conf.d ]; then + NGINX_CONF="/etc/nginx/conf.d/zammad.conf" + test -f /etc/nginx/conf.d/zammad.conf || cp ${ZAMMAD_DIR}/contrib/nginx/zammad.conf /etc/nginx/conf.d/zammad.conf fi echo "# Restarting Nginx" ${INIT_CMD} restart nginx - echo -e "\nOpen http://localhost in your browser to start using Zammad!\n" + echo -e "\nAdd your FQDN to servername directive in ${NGINX_CONF} and restart nginx if you're not testing localy" + echo -e "or open http://localhost in your browser to start using Zammad.\n" else - echo -e "\nOpen http://localhost:3000 in your browser to start using Zammad!\n" + echo -e "\nOpen http://localhost:3000 in your browser to start using Zammad.\n" fi