cn-progload: fix program uploading and add the sig file
This commit is contained in:
parent
4beeb5a521
commit
8346e5ea59
|
@ -1,7 +1,11 @@
|
||||||
cn-progload() {
|
cn-progload() {
|
||||||
local addr="$1"
|
local addr="$1"
|
||||||
local project="$2"
|
local project="$2" # /foo/bar/baz.bunk
|
||||||
local ext="${project##*.}"
|
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
|
# Add a zero in front of the 3rd arg
|
||||||
local slot="0${3}"
|
local slot="0${3}"
|
||||||
# expand only to the last 2 digits of $slot
|
# expand only to the last 2 digits of $slot
|
||||||
|
@ -11,11 +15,11 @@ cn-progload() {
|
||||||
case $ext in
|
case $ext in
|
||||||
|
|
||||||
vtz)
|
vtz)
|
||||||
if [[ ! -z $slot ]]; then
|
if [[ -n $slot ]]; then
|
||||||
echo "==NOTICE== Ignoring slot number for touchpanel project..."
|
echo "==NOTICE== Ignoring slot number for touchpanel project..."
|
||||||
fi
|
fi
|
||||||
printf 'put %q' "$project" | cnsftp $addr:display
|
printf 'put %q' "$project" | cnsftp "$addr:display"
|
||||||
cnssh $addr projectload
|
cnssh "$addr" projectload
|
||||||
;;
|
;;
|
||||||
|
|
||||||
lpz)
|
lpz)
|
||||||
|
@ -23,8 +27,16 @@ cn-progload() {
|
||||||
echo "==NOTICE== No target program slot defined. Assuming Slot 01..."
|
echo "==NOTICE== No target program slot defined. Assuming Slot 01..."
|
||||||
slot=01
|
slot=01
|
||||||
fi
|
fi
|
||||||
printf 'put %q' "$project" | cnsftp $addr:Program$slot
|
# Stop and delete current program in $slot
|
||||||
cnssh $addr progload -p:$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"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
|
Loading…
Reference in New Issue