From 212e4b4859e07591271a87979b1911052f2d917a Mon Sep 17 00:00:00 2001
From: Navid Nikaein <navid.nikaein@eurecom.fr>
Date: Wed, 14 Jan 2015 09:56:38 +0000
Subject: [PATCH] few updates for the autobuild

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6360 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair-cn/GTPV1-U/GTPUAH/Makefile |  1 +
 openair-cn/GTPV1-U/GTPURH/Makefile |  1 +
 targets/build_helper.bash          |  9 ++++++++-
 targets/build_oai.bash             | 19 +++++++++++--------
 4 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/openair-cn/GTPV1-U/GTPUAH/Makefile b/openair-cn/GTPV1-U/GTPUAH/Makefile
index 8fcb74e5a7..1c581789e4 100755
--- a/openair-cn/GTPV1-U/GTPUAH/Makefile
+++ b/openair-cn/GTPV1-U/GTPUAH/Makefile
@@ -20,6 +20,7 @@ EXTRA_CFLAGS += -DKVERSION=$(KVERSION_LAST_DIGIT)
 all: xtlib
 	echo "Building for Kernel Version: $(KVERSION_LAST_DIGIT)"
 	make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
+	chmod 777 xt_GTPUAH.ko
 	mv xt_GTPUAH.ko $(BIN_DIR)/
 
 clean: libclean
diff --git a/openair-cn/GTPV1-U/GTPURH/Makefile b/openair-cn/GTPV1-U/GTPURH/Makefile
index af4107a904..9673039612 100755
--- a/openair-cn/GTPV1-U/GTPURH/Makefile
+++ b/openair-cn/GTPV1-U/GTPURH/Makefile
@@ -21,6 +21,7 @@ EXTRA_CFLAGS += -DKVERSION=$(KVERSION_LAST_DIGIT)
 all: xtlib
 	echo "Building for Kernel Version: $(KVERSION_LAST_DIGIT)"
 	make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
+	chmod 777 xt_GTPURH.ko
 	mv xt_GTPURH.ko $(BIN_DIR)/
 
 clean: libclean
diff --git a/targets/build_helper.bash b/targets/build_helper.bash
index 1f6d80bca1..4197901cda 100755
--- a/targets/build_helper.bash
+++ b/targets/build_helper.bash
@@ -305,6 +305,12 @@ check_install_freediamter(){
    
 }
 
+
+test_is_host_reachable() {
+    ping -c 1 $1 > /dev/null || { echo_fatal "$1 does not respond to ping" >&2 ; }
+}
+
+
 check_epc_s6a_certificate() {
     if [ -d /usr/local/etc/freeDiameter ]
     then
@@ -324,8 +330,9 @@ check_epc_s6a_certificate() {
     ./make_certs.sh ${1:-'eur'}
     if [ $# -lt 2 ] ; then
         check_epc_s6a_certificate ${1:-'eur'}  2
+    else
+       exit 1
     fi
-    exit 1
 }
 
 
diff --git a/targets/build_oai.bash b/targets/build_oai.bash
index 66665753bd..4599a526f7 100755
--- a/targets/build_oai.bash
+++ b/targets/build_oai.bash
@@ -814,13 +814,15 @@ if [ $RUN -ne 0 ]; then
         
         'EPC')
             echo "############# running EPC #############"
+            #test_is_host_reachable 
             if [ $RUN_GDB -eq 0 ]; then
                 $SUDO $OPENAIR_TARGETS/bin/oai_epc  `echo $EXE_ARGUMENTS`
             else
-                $SUDO touch ~/.gdb_epc
-                $SUDO echo "file $OPENAIR_TARGETS/bin/oai_epc" > ~/.gdb_epc
-                $SUDO echo "set args $EXE_ARGUMENTS" >> ~/.gdb_epc
-                $SUDO echo "run" >> ~/.gdb_epc
+                touch ~/.gdb_epc
+                chmod 777 ~/.gdb_epc
+                echo "file $OPENAIR_TARGETS/bin/oai_epc" > ~/.gdb_epc
+                echo "set args $EXE_ARGUMENTS" >> ~/.gdb_epc
+                echo "run" >> ~/.gdb_epc
                 $SUDO gdb -nh -x ~/.gdb_epc 2>&1 
             fi
             ;;
@@ -832,10 +834,11 @@ if [ $RUN -ne 0 ]; then
             if [ $RUN_GDB -eq 0 ]; then
                 $SUDO exec ./openair-hss -c conf/hss.local.conf
             else
-                $SUDO touch ~/.gdb_hss
-                $SUDO echo "file ./openair-hss" > ~/.gdb_hss
-                $SUDO echo "set args -c conf/hss.local.conf" >> ~/.gdb_hss
-                $SUDO echo "run" >> ~/.gdb_hss
+                touch ~/.gdb_hss
+                chmod 777 ~/.gdb_hss
+                echo "file ./openair-hss" > ~/.gdb_hss
+                echo "set args -c conf/hss.local.conf" >> ~/.gdb_hss
+                echo "run" >> ~/.gdb_hss
                 $SUDO gdb -nh -x ~/.gdb_hss 2>&1 
             fi
              ;;
-- 
GitLab