Change in osmo-dev[master]: find the terminal once and abort if missing

2018-10-24 Thread osmith
osmith has posted comments on this change. ( https://gerrit.osmocom.org/11143 )

Change subject: find the terminal once and abort if missing
..


Patch Set 6: Verified+1


--
To view, visit https://gerrit.osmocom.org/11143
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
Gerrit-Change-Number: 11143
Gerrit-PatchSet: 6
Gerrit-Owner: osmith 
Gerrit-Assignee: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: osmith 
Gerrit-Comment-Date: Wed, 24 Oct 2018 10:49:23 +
Gerrit-HasComments: No
Gerrit-HasLabels: Yes


Change in osmo-dev[master]: find the terminal once and abort if missing

2018-10-24 Thread osmith
osmith has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/11143 )

Change subject: find the terminal once and abort if missing
..

find the terminal once and abort if missing

Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
---
M net/tmpl_std/run.sh
1 file changed, 16 insertions(+), 4 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  osmith: Verified



diff --git a/net/tmpl_std/run.sh b/net/tmpl_std/run.sh
index 57dcc23..cca7a75 100755
--- a/net/tmpl_std/run.sh
+++ b/net/tmpl_std/run.sh
@@ -34,18 +34,30 @@
 logdir="current_log"
 mkdir -p "$logdir"

+find_term() {
+  # Find a terminal program and write to the global "terminal" variable
+  local programs="urxvt xterm"
+  local program
+  for program in $programs; do
+terminal="$(which $program)"
+[ -n "$terminal" ] && return
+  done
+
+  # No terminal found
+  echo "ERROR: Couldn't find terminal program! Looked for: $programs"
+  exit 1
+}
+
 term() {
   title="$2"
   if [ -z "$title" ]; then
 title="$(basename $@)"
   fi
-  terminal="$(which urxvt || which xterm)"
-  if ! which $terminal; then
-echo "CANNOT FIND XTERM PROGRAM"
-  fi
   exec $terminal -title "CN:$title" -e sh -c "export 
LD_LIBRARY_PATH='/usr/local/lib'; $1; echo; while true; do echo 'q Enter to 
close'; read q_to_close; if [ \"x\$q_to_close\" = xq ]; then break; fi; done"
 }

+find_term
+
 sudo tcpdump -i $dev -n -w current_log/$dev.single.pcap -U not port 22 &
 sudo tcpdump -i lo -n -w current_log/lo.single.pcap -U not port 22 &


--
To view, visit https://gerrit.osmocom.org/11143
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
Gerrit-Change-Number: 11143
Gerrit-PatchSet: 6
Gerrit-Owner: osmith 
Gerrit-Assignee: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Reviewer: osmith 


Change in osmo-dev[master]: find the terminal once and abort if missing

2018-10-12 Thread Neels Hofmeyr
Neels Hofmeyr has posted comments on this change. ( 
https://gerrit.osmocom.org/11143 )

Change subject: find the terminal once and abort if missing
..


Patch Set 6: Code-Review+2

(2 comments)

https://gerrit.osmocom.org/#/c/11143/6/net/tmpl_std/run.sh
File net/tmpl_std/run.sh:

https://gerrit.osmocom.org/#/c/11143/6/net/tmpl_std/run.sh@37
PS6, Line 37: find_term() {
(I'd have just put it on the root level scope, but fine if you think a function 
looks better...)


https://gerrit.osmocom.org/#/c/11143/6/net/tmpl_std/run.sh@43
PS6, Line 43: [ -n "$terminal" ] && return
I find the expanded 'if' clauses easier to read, especially for people not that 
familiar with shell scripting.

Anyway. next time is fine.



--
To view, visit https://gerrit.osmocom.org/11143
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
Gerrit-Change-Number: 11143
Gerrit-PatchSet: 6
Gerrit-Owner: osmith 
Gerrit-Assignee: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 
Gerrit-Comment-Date: Fri, 12 Oct 2018 10:51:01 +
Gerrit-HasComments: Yes
Gerrit-HasLabels: Yes


Change in osmo-dev[master]: find the terminal once and abort if missing

2018-10-12 Thread osmith
Hello Pau Espin Pedrol, Neels Hofmeyr,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/11143

to look at the new patch set (#6).

Change subject: find the terminal once and abort if missing
..

find the terminal once and abort if missing

Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
---
M net/tmpl_std/run.sh
1 file changed, 16 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/43/11143/6
--
To view, visit https://gerrit.osmocom.org/11143
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
Gerrit-Change-Number: 11143
Gerrit-PatchSet: 6
Gerrit-Owner: osmith 
Gerrit-Assignee: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol 


Change in osmo-dev[master]: find the terminal once and abort if missing

2018-10-12 Thread osmith
Hello Pau Espin Pedrol, Neels Hofmeyr,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/11143

to look at the new patch set (#5).

Change subject: find the terminal once and abort if missing
..

find the terminal once and abort if missing

Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
---
M net/tmpl_std/run.sh
1 file changed, 18 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/43/11143/5
--
To view, visit https://gerrit.osmocom.org/11143
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: Ie823e17ff1e7ad3ba23998233b41a810c90858b3
Gerrit-Change-Number: 11143
Gerrit-PatchSet: 5
Gerrit-Owner: osmith 
Gerrit-Assignee: Neels Hofmeyr 
Gerrit-Reviewer: Neels Hofmeyr 
Gerrit-Reviewer: Pau Espin Pedrol