]> hydra-www.ietfng.org Git - acmetensortoys-esp-lua_ctfws/commitdiff
examples/ctfws/pushall.sh more better
authorNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Mon, 30 Jan 2017 01:52:02 +0000 (20:52 -0500)
committerNathaniel Wesley Filardo <nwf@cs.jhu.edu>
Mon, 30 Jan 2017 20:09:01 +0000 (15:09 -0500)
pushall.sh

index aa2baa9fb145427aa4d174d331ae92d79a0304bb..b0c0aac757e8c7b653eda59fe7a1ba398e4cae02 100755 (executable)
@@ -4,14 +4,50 @@ set -e -u
 
 . ./host/pushcommon.sh
 
-dopushcompile net/nwfmqtt.lua
-dopush        examples/ctfws/conf/nwfnet.conf
-dopush        examples/ctfws/conf/nwfnet.conf2
-dopush        examples/ctfws/conf/nwfmqtt.conf
-dopushcompile _external/lcd1602.lua
-dopushcompile examples/ctfws/ctfws.lua
-dopushcompile examples/ctfws/ctfws-lcd.lua
-dopushcompile examples/ctfws/init3.lua
-dopushcompile examples/ctfws/init2.lua
+pushsrc() {
+  dopushcompile net/nwfmqtt.lua
+  dopushcompile _external/lcd1602.lua
+  dopushcompile examples/ctfws/ctfws.lua
+  dopushcompile examples/ctfws/ctfws-lcd.lua
+  dopushcompile examples/ctfws/init3.lua
+  dopushcompile examples/ctfws/init2.lua
+}
 
-echo "SUCCESS"
+if [ -n "${2:-}" ]; then
+  if [ -d examples/ctfws/conf/$2 ]; then CONFDIR=examples/ctfws/conf/$2
+  elif [ -d $1 ]; then CONFDIR=$2
+  else echo "Not a directory: $2"; exit 1
+  fi
+fi
+
+pushconf() {
+  if [ -z "${CONFDIR:-}" ]; then
+    echo "Asked to push config without specifying?"
+    exit 1
+  fi
+  for f in ${CONFDIR}/*; do
+    dopush "$f"
+  done
+}
+
+case "${1:-}" in
+  all)
+    pushconf
+    pushsrc
+    ./host/pushinit.sh
+    ;;
+  both)
+    pushconf
+    pushsrc
+    ;;
+  src)
+    pushsrc
+    ;;
+  conf)
+    pushconf
+    ;;
+  *)
+    echo "Please specify push mode: {conf,src,both,all}"
+    exit 1
+    ;;
+esac