From fa36ee89d8b4d59a3c50f6fe84b396fd76a83046 Mon Sep 17 00:00:00 2001
From: Alexander Lutay <alutay@sipwise.com>
Date: Wed, 2 Mar 2016 12:31:08 +0100
Subject: [PATCH] MT#17673 Bypass deployment.sh debug mode to ngcp-installer
 (if enabled)

Change-Id: Ia92c3861dc12bd21c6da70a2d09474fab78093cf
---
 deployment.sh | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/deployment.sh b/deployment.sh
index ae1f3fe..3e0607c 100755
--- a/deployment.sh
+++ b/deployment.sh
@@ -30,6 +30,7 @@ export LANG=C
 unset SHELL
 
 # defaults
+DEBUG_MODE=false
 DEFAULT_INSTALL_DEV=eth0
 DEFAULT_IP1=192.168.255.251
 DEFAULT_IP2=192.168.255.252
@@ -327,14 +328,14 @@ die() {
 }
 
 enable_trace() {
-  if checkBootParam debugmode ; then
+  if "${DEBUG_MODE}" ; then
     set -x
     PS4='+\t '
   fi
 }
 
 disable_trace() {
-  if checkBootParam debugmode ; then
+  if "${DEBUG_MODE}" ; then
     set +x
     PS4=''
   fi
@@ -352,7 +353,10 @@ enable_deploy_status_server
 
 set_deploy_status "checkBootParam"
 
-enable_trace
+if checkBootParam debugmode ; then
+  DEBUG_MODE=true
+  enable_trace
+fi
 
 if checkBootParam ngcpstatus ; then
   STATUS_WAIT=$(getBootParam ngcpstatus || true)
@@ -1602,6 +1606,7 @@ SIPWISE_REPO_HOST="${SIPWISE_REPO_HOST}"
 SIPWISE_REPO_TRANSPORT="${SIPWISE_REPO_TRANSPORT}"
 NAMESERVER="$(awk '/^nameserver/ {print $2}' /etc/resolv.conf)"
 NGCP_PPA="${NGCP_PPA}"
+DEBUG_MODE="${DEBUG_MODE}"
 EOF
 
   cat "${TARGET}/etc/ngcp-installer/config_deploy.inc" > /tmp/ngcp-installer-cmdline.log