Added Crestron helper functions
This commit is contained in:
parent
f6219cb894
commit
f3176367f1
|
@ -0,0 +1,20 @@
|
|||
cn-fwupd() {
|
||||
local addr="$1"
|
||||
local puf="$2"
|
||||
local ext="${puf##*.}"
|
||||
|
||||
case $ext in
|
||||
|
||||
zip)
|
||||
printf 'put %q firmware/update.zip' "$puf" | cnsftp $addr
|
||||
cnssh $addr pushupdate FULL
|
||||
;;
|
||||
puf)
|
||||
printf 'put %q firmware/update.puf' "$puf" | cnsftp $addr
|
||||
cnssh $addr puf
|
||||
;;
|
||||
*)
|
||||
echo "Error: Bad file type. Currently, only'.zip' and '.puf' file types are supported."
|
||||
;;
|
||||
esac
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
cn-progload() {
|
||||
local addr="$1"
|
||||
local project="$2"
|
||||
local ext="${project##*.}"
|
||||
# Add a zero in front of the 3rd arg
|
||||
local slot="0${3}"
|
||||
# expand only to the last 2 digits of $slot
|
||||
slot="${slot: -2}"
|
||||
|
||||
|
||||
case $ext in
|
||||
|
||||
vtz)
|
||||
if [[ ! -z $slot ]]; then
|
||||
echo "==NOTICE== Ignoring slot number for touchpanel project..."
|
||||
fi
|
||||
printf 'put %q' "$project" | cnsftp $addr:display
|
||||
cnssh $addr projectload
|
||||
;;
|
||||
|
||||
lpz)
|
||||
if [[ -z $slot ]]; then
|
||||
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
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Error: Bad file type. Currently only supports vtz and lpz projects."
|
||||
;;
|
||||
esac
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
cnsftp() {
|
||||
# sshpass -p "" ssh Crestron@192.168.0.51
|
||||
local uname="Crestron"
|
||||
local pass=""
|
||||
local cmd="$@"
|
||||
|
||||
sshpass -p "$pass" sftp \
|
||||
-o StrictHostKeyChecking=no\
|
||||
-o GlobalKnownHostsFile=/dev/null\
|
||||
-o UserKnownHostsFile=/dev/null\
|
||||
-o User="$uname" \
|
||||
"$cmd"
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
cnssh() {
|
||||
# Usage: cnssh <ip address> [command]
|
||||
# sshpass -p "" ssh Crestron@192.168.0.51
|
||||
local uname="Crestron"
|
||||
local pass=""
|
||||
local addr="$1"
|
||||
shift
|
||||
local cmd="$@"
|
||||
|
||||
sshpass -p "$pass" ssh \
|
||||
-o StrictHostKeyChecking=no\
|
||||
-o GlobalKnownHostsFile=/dev/null\
|
||||
-o UserKnownHostsFile=/dev/null\
|
||||
"$uname"@"$addr" "$cmd"
|
||||
}
|
Loading…
Reference in New Issue