UpdateController/news_from_ismas

36 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-06-02 18:11:04 +02:00
# !/bin/bash -
source ./log_helpers
if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
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\""
2022-06-04 21:43:57 +02:00
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