osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-dev/+/27033 )


Change subject: net: make terminal configurable in config file
......................................................................

net: make terminal configurable in config file

Change-Id: I0afb6b0242c399334a2c37f18a5d26d5beeabedc
---
M net/config_2g3g
M net/templates/run.sh
2 files changed, 22 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/33/27033/1

diff --git a/net/config_2g3g b/net/config_2g3g
index c1498be..ab6c2a2 100644
--- a/net/config_2g3g
+++ b/net/config_2g3g
@@ -1,3 +1,7 @@
+# Terminal for launching Osmocom programs
+# Supported: auto, urxvt, xterm
+TERMINAL="auto"
+
 ETH_DEV=eth0
 APN_DEV=apn0

diff --git a/net/templates/run.sh b/net/templates/run.sh
index 311cdd9..af7bc36 100755
--- a/net/templates/run.sh
+++ b/net/templates/run.sh
@@ -44,10 +44,27 @@
 find_term() {
   # Find a terminal program and write to the global "terminal" variable
   local programs="urxvt xterm"
+
+  if [ -n "${TERMINAL}" ] && [ "${TERMINAL}" != "auto" ]; then
+    case " $programs " in
+      *" ${TERMINAL} "*)
+        echo "Terminal: ${TERMINAL} (from config)"
+        terminal="${TERMINAL}"
+        return
+        ;;
+    esac
+
+    echo "ERROR: Terminal '${TERMINAL}' is not in list of supported terminals 
($programs)"
+    exit 1
+  fi
+
   local program
   for program in $programs; do
     terminal="$(which $program)"
-    [ -n "$terminal" ] && return
+    if [ -n "$terminal" ]; then
+      echo "Terminal: $program (auto)"
+      return
+    fi
   done

   # No terminal found

--
To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/27033
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: I0afb6b0242c399334a2c37f18a5d26d5beeabedc
Gerrit-Change-Number: 27033
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to