From 6e0e9812eb3f932e066c49f25a46da12e4c11463 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Tue, 11 Oct 2016 18:09:45 -0400 Subject: [PATCH] host/pushcommon.sh for push scripts --- host/pushcommon.sh | 11 +++++++++++ host/pushinit.sh | 12 +----------- 2 files changed, 12 insertions(+), 11 deletions(-) create mode 100644 host/pushcommon.sh diff --git a/host/pushcommon.sh b/host/pushcommon.sh new file mode 100644 index 0000000..730f70f --- /dev/null +++ b/host/pushcommon.sh @@ -0,0 +1,11 @@ +if [ -z ${HOST:-} ]; then + # Uses LUATOOL to push init and dependencies to the device; bootstrap! + PUSHCMD="${LUATOOL} --delay 0.1 -p ${MCUPORT} -b ${MCUBAUD}" + dopush() { ${PUSHCMD} -f $1 -t ${2:-`basename $1`}; } + dopushcompile() { ${PUSHCMD} -f $1 -t ${2:-`basename $1`} -c; } +else + # Uses host/pushvia to push everything if HOST is set + PUSHCMD="./host/pushvia.expect ${HOST} ${PORT:-23}" + dopush() { ${PUSHCMD} ${2:-`basename $1`} $1; } + dopushcompile() { ${PUSHCMD} ${2:-`basename $1`} $1 compile; } +fi diff --git a/host/pushinit.sh b/host/pushinit.sh index a48c051..504d587 100755 --- a/host/pushinit.sh +++ b/host/pushinit.sh @@ -1,17 +1,7 @@ #!/bin/bash set -e -u -if [ -z ${HOST:-} ]; then - # Uses LUATOOL to push init and dependencies to the device; bootstrap! - PUSHCMD="${LUATOOL} --delay 0.1 -p ${MCUPORT} -b ${MCUBAUD}" - dopush() { ${PUSHCMD} -f $1 -t ${2:-`basename $1`}; } - dopushcompile() { ${PUSHCMD} -f $1 -t ${2:-`basename $1`} -c; } -else - # Uses host/pushvia to push everything if HOST is set - PUSHCMD="./host/pushvia.expect ${HOST} ${PORT:-23}" - dopush() { ${PUSHCMD} ${2:-`basename $1`} $1; } - dopushcompile() { ${PUSHCMD} ${2:-`basename $1`} $1 compile; } -fi +. ./host/pushcommon.sh dopushcompile util/diag.lua dopushcompile tq/tq.lua -- 2.50.1