From 8bda5068aea44cabcbbe600fa3539a3ed81670cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Bauer?= Date: Tue, 6 Dec 2016 19:12:19 +0100 Subject: [PATCH] added debug mode to postinstall.sh --- contrib/packager.io/config | 2 +- contrib/packager.io/functions | 17 ++++++++++++----- contrib/packager.io/postinstall.sh | 4 ++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/contrib/packager.io/config b/contrib/packager.io/config index ce0b90090..1210fc501 100644 --- a/contrib/packager.io/config +++ b/contrib/packager.io/config @@ -10,4 +10,4 @@ MY_CNF="/etc/mysql/debian.cnf" ZAMMAD_WEBS="1" ZAMMAD_WEBSOCKETS="1" ZAMMAD_WORKERS="1" -DEBUG_OUTPUT="no" +DEBUG="no" diff --git a/contrib/packager.io/functions b/contrib/packager.io/functions index 1e8d5963e..8f0962377 100644 --- a/contrib/packager.io/functions +++ b/contrib/packager.io/functions @@ -3,6 +3,13 @@ # packager.io postinstall script functions # +function debug() { + if [ "${DEBUG}" == "yes" ]; then + echo "DEBUG MODE ON" + set -e + fi +} + function detect_os () { . /etc/os-release @@ -16,7 +23,7 @@ function detect_os () { OS="UNKNOWN" fi - if [ "${DEBUG_OUTPUT}" == "yes" ]; then + if [ "${DEBUG}" == "yes" ]; then echo "OS is ${OS} based" fi } @@ -28,7 +35,7 @@ function detect_docker() { DOCKER="no" fi - if [ "${DEBUG_OUTPUT}" == "yes" ]; then + if [ "${DEBUG}" == "yes" ]; then echo "os runs in docker container = ${DOCKER}" fi } @@ -49,7 +56,7 @@ function detect_initcmd () { INIT_CMD="initctl" fi - if [ "${DEBUG_OUTPUT}" == "yes" ]; then + if [ "${DEBUG}" == "yes" ]; then echo "INIT CMD = ${INIT_CMD}" fi } @@ -62,7 +69,7 @@ function detect_database () { ADAPTER="mysql2" fi - if [ "${DEBUG_OUTPUT}" == "yes" ]; then + if [ "${DEBUG}" == "yes" ]; then echo "Use ${ADAPTER} adapter in database.yml" fi } @@ -94,7 +101,7 @@ function detect_webserver () { fi fi - if [ "${DEBUG_OUTPUT}" == "yes" ]; then + if [ "${DEBUG}" == "yes" ]; then echo "Webserver is ${WEBSERVER_CMD}" fi } diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index 73fa89aff..96b3a2324 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -5,14 +5,14 @@ PATH=/opt/zammad/bin:/opt/zammad/vendor/bundle/bin:/sbin:/bin:/usr/sbin:/usr/bin: -#set -e - # import config . /opt/zammad/contrib/packager.io/config # import functions . /opt/zammad/contrib/packager.io/functions +debug + detect_os detect_docker