cn-progload: fix program uploading and add the sig file

This commit is contained in:
David Thurstenson 2021-05-06 17:44:34 -05:00
parent 4beeb5a521
commit 8346e5ea59
1 changed files with 19 additions and 7 deletions

View File

@ -1,7 +1,11 @@
cn-progload() {
local addr="$1"
local project="$2"
local ext="${project##*.}"
local project="$2" # /foo/bar/baz.bunk
local ext="${project##*.}" # bunk
local projfname="${project%.*}" # /foo/bar/baz
local projfnamebase="${projfname##*/}" # baz
local zigstash
zigstash="$(mktemp /tmp/$projfnamebase.XXXX.zig)"
# Add a zero in front of the 3rd arg
local slot="0${3}"
# expand only to the last 2 digits of $slot
@ -11,11 +15,11 @@ cn-progload() {
case $ext in
vtz)
if [[ ! -z $slot ]]; then
if [[ -n $slot ]]; then
echo "==NOTICE== Ignoring slot number for touchpanel project..."
fi
printf 'put %q' "$project" | cnsftp $addr:display
cnssh $addr projectload
printf 'put %q' "$project" | cnsftp "$addr:display"
cnssh "$addr" projectload
;;
lpz)
@ -23,8 +27,16 @@ cn-progload() {
echo "==NOTICE== No target program slot defined. Assuming Slot 01..."
slot=01
fi
printf 'put %q' "$project" | cnsftp $addr:Program$slot
cnssh $addr progload -p:$slot
# Stop and delete current program in $slot
cnssh "$addr" killprog -P$slot
# Upload
printf 'put %q' "$project" | cnsftp "$addr:Program$slot"
# Load the program
cnssh "$addr" progload -p:$slot
# Zip up the sig file in a temporary location
zip -j - "$projfname.sig" > "$zigstash"
# Upload the zig
printf 'put %q %q' "$zigstash" "$projfnamebase.zig" | cnsftp "$addr:Program$slot"
;;
*)