diff --git a/news_to_ismas b/news_to_ismas index 8e6dba9..cb8bb60 100755 --- a/news_to_ismas +++ b/news_to_ismas @@ -24,77 +24,6 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once PERCENT=1 - news_to_ismas () { - # $1: EVENT: U0001 update finished: 100% - # U0002 reset TRG - # U0003 error - # U0010 for update process - # $2: PERCENT : "only for ISMAS: 0-100%", - # $3: RESULTCODE : "only for ISMAS", - # 0: Success - # 1: no Update nessesary - # 2: Backup failed - # 3: Package error/ Wrong package - # 4: Install Error - # $4: STEP : "running step (only for us): update_psa...", - # $5: STEP_RESULT : "error and result text", - # $6: VERSION : "opkg and conf info; what will be updated" - # - local func="${FUNCNAME[0]}" - local p=("$@") - local data="#M=APISM#C=CMD_EVENT#J= - { - \"REASON\":\"SW_UP\", - \"TIMESTAMP\":\"$(date +%Y-%m-%dT%T.000%z)\", - \"EVENT_ID\":\"0\", - \"EVENT\":\"${p[0]}\", - \"EVENTSTATE\":1, - \"PARAMETER\": { - \"PERCENT\" : ${p[1]}, - \"RESULTCODE\" : ${p[2]}, - \"STEP\" : \"update_psa_${p[3]}\", - \"STEP_RESULT\" : \"${p[4]}\", - \"VERSION\" : \"${p[5]}\" - } - }" - log_debug "$func:${LINENO}: data=$data" - echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT) - } - - # - # send current psa setting to ismas at end of update procedure - # - current_settings_to_ismas () { - local func="${FUNCNAME[0]}" - local p=("$@") - local data="#M=APISM#C=CMD_SENDVERSION#J= - { - \"TARIFF\": { - $(<$TARIFF_CURRENT_FULL) - }, - \"HARDWARE\" : { - \"DEVICES\" : [ - \"PTU5\", \"DC\", \"PRINTER\", \"BNA\" - ] - }, - \"OS\" : { - \"$(uname)\": \"$(uname -a)\" - }, - \"CONFIG\" : { - \"PTU5\" : { - }, - \"DC\" : { - }, - \"PRINTER\" : { - }, - \"BNA\" : { - } - } - }" - log_debug "$func:${LINENO}: data=$data" - echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT) - } - ########################################################################### ########################################################################### @@ -388,4 +317,109 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once reset_update_trigger return $? } + + ########################################################################### + ########################################################################### + + news_to_ismas () { + # $1: EVENT: U0001 update finished: 100% + # U0002 reset TRG + # U0003 error + # U0010 for update process + # $2: PERCENT : "only for ISMAS: 0-100%", + # $3: RESULTCODE : "only for ISMAS", + # 0: Success + # 1: no Update nessesary + # 2: Backup failed + # 3: Package error/ Wrong package + # 4: Install Error + # $4: STEP : "running step (only for us): update_psa...", + # $5: STEP_RESULT : "error and result text", + # $6: VERSION : "opkg and conf info; what will be updated" + # + local func="${FUNCNAME[0]}" + local p=("$@") + local data="#M=APISM#C=CMD_EVENT#J= + { + \"REASON\":\"SW_UP\", + \"TIMESTAMP\":\"$(date +%Y-%m-%dT%T.000%z)\", + \"EVENT_ID\":\"0\", + \"EVENT\":\"${p[0]}\", + \"EVENTSTATE\":1, + \"PARAMETER\": { + \"PERCENT\" : ${p[1]}, + \"RESULTCODE\" : ${p[2]}, + \"STEP\" : \"update_psa_${p[3]}\", + \"STEP_RESULT\" : \"${p[4]}\", + \"VERSION\" : \"${p[5]}\" + } + }" + log_debug "$func:${LINENO}: data=$data" + echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT) + } + + # + # send current psa setting to ismas at end of update procedure + # + current_settings_to_ismas () { + local func="${FUNCNAME[0]}" + local p=("$@") + local data="#M=APISM#C=CMD_SENDVERSION#J= + { + \"TARIFF\": { + $(<$TARIFF_CURRENT_FULL) + }, + \"HARDWARE\" : { + \"DEVICES\" : [ + \"PTU5\", \"DC\", \"PRINTER\", \"BNA\" + ] + }, + \"OS\" : { + \"$(uname)\": \"$(uname -a)\" + }, + \"CONFIG\" : { + \"PTU5\" : { + \"CPU_SERIAL\" : \"$(cat /proc/cpuinfo | + grep Serial | + sed -E -e 's/.*:\s*(.*)/\1/g')\" + }, + \"DC\" : { + \"VERSION\" : \"$(cat $UPDATE_CONF | jq -r .dc.version)\", + \"MD5SUM\" : \"$(cat $UPDATE_CONF | jq -r .dc.dc2c)\" + }, + \"PRINTER\" : { + }, + \"BNA\" : { + } + }, + \"SOFTWARE\": { + \"RAUC\" : \"$(rauc --version)\", + \"OPKG\" : \"$(opkg --version)\", + \"ATBQT\" : { + \"VERSION\" : \"$($ATBQT_SYS_FULL -v | + grep Version | + sed -E -e 's/.*:\s*(.*)/\1/g')\", + \"GIT_DESCRIBE\" : \"$($ATBQT_SYS_FULL -v | + grep git | + sed -E -e 's/.*:\s*(.*)/\1/g')\" + }, + \"PLUGINS\" : { + $(get_plugins) + } + } + }" + log_debug "$func:${LINENO}: data=$data" + + echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT) + + # if [ $EXITCODE -eq $RC_SUCCESS ]; then + update_psa_update_succeeded $UPDATE_SUCCEEDED \ + $RC_SUCCESS "psa update succeeded" + + update_psa_update_succeeded $UPDATE_ACTIVATED \ + $RC_SUCCESS "psa update activated" + + log_info "$func:${LINENO}: success" + # fi + } fi