37 lines
1.3 KiB
Plaintext
Executable File
37 lines
1.3 KiB
Plaintext
Executable File
# !/bin/bash -
|
|
|
|
source ./log_helpers
|
|
|
|
if [ "${news_from_ismas_sourced:-1}" = "1" ]; then # include only once
|
|
readonly news_from_ismas_sourced=${BASH_SOURCE[0]}
|
|
readonly APISM_DIRECT_PORT=7778
|
|
|
|
updates_available () {
|
|
local func="${FUNCNAME[0]}"
|
|
local json_response="$((echo -n '#M=APISM #C=REQ_ISMASParameter #J={}';
|
|
sleep 1) | nc localhost $APISM_DIRECT_PORT)"
|
|
if [ $? -eq 0 ]; then
|
|
local trigger="$(echo $json_response | jq -r .Fileupload.TRG)"
|
|
log_debug "$func:${LINENO}: apism_trigger=\"$trigger\""
|
|
grep -qE "WAIT" <<< "$trigger" && return 0
|
|
else
|
|
log_error "$func:${LINENO}: apism request failed"
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
update_status () {
|
|
local func="${FUNCNAME[0]}"
|
|
local json_response="$((echo -n '#M=APISM #C=REQ_ISMASParameter #J={}';
|
|
sleep 1) | nc localhost $APISM_DIRECT_PORT)"
|
|
local trigger=""
|
|
if [ $? -eq 0 ]; then
|
|
trigger="$(echo $json_response | jq -r .Fileupload.TRG)"
|
|
log_debug "$func:${LINENO}: apism_trigger=\"$trigger\""
|
|
else
|
|
log_error "$func:${LINENO}: apism request failed"
|
|
fi
|
|
echo "$trigger"
|
|
}
|
|
fi
|