From 84875e09285d48f79abee2e14ad71a9689a82605 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Sun, 29 Jan 2017 20:52:02 -0500 Subject: [PATCH] examples/ctfws/pushall.sh more better --- pushall.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 46 insertions(+), 10 deletions(-) diff --git a/pushall.sh b/pushall.sh index aa2baa9..b0c0aac 100755 --- a/pushall.sh +++ b/pushall.sh @@ -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 -- 2.50.1