Compare commits
No commits in common. "262a851045fcb3c02366331190bea55ec36431c9" and "05714985030e5a37f2c440f24d045167a7105216" have entirely different histories.
262a851045
...
0571498503
@ -173,7 +173,7 @@ pull_customer_repository () {
|
|||||||
|
|
||||||
log_debug "$func:${LINENO} git-pull-result=${git_result}"
|
log_debug "$func:${LINENO} git-pull-result=${git_result}"
|
||||||
|
|
||||||
if grep -qE "^.*?Already\s+\up\s+\to\s+date.*$" <<< "$git_result"; then
|
if grep -qE "^Already\s+\up\s+\to\s+date.*$" <<< "$git_result"; then
|
||||||
log_warn "$func:${LINENO}: repository $PWD already up to date."
|
log_warn "$func:${LINENO}: repository $PWD already up to date."
|
||||||
read $1 <<< 'yes'
|
read $1 <<< 'yes'
|
||||||
cd_home ; return 1
|
cd_home ; return 1
|
||||||
|
16
load_tariff
16
load_tariff
@ -1,16 +0,0 @@
|
|||||||
#! /bin/bash -
|
|
||||||
# set -x
|
|
||||||
|
|
||||||
if [ $# -eq 2 ]; then
|
|
||||||
if [ -f $1 ]; then
|
|
||||||
out="\"VERSION\":\"$(cat $1 | jq -r .version)\"",
|
|
||||||
out+="\"PROJECT\":\"$(cat $1 | jq -r .project)\"",
|
|
||||||
out+="\"ZONE\":$(cat $1 | jq -r .zone)",
|
|
||||||
out+="\"INFO\":\"$(cat $1 | jq -r .info)\"",
|
|
||||||
out+="\"LOADED\":\"$(date +%Y-%m-%dT%T)\""
|
|
||||||
echo $out > $2
|
|
||||||
exit $?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Usage: ./${0##*/} <tariff.config> <tariff.current>"
|
|
142
news_to_ismas
142
news_to_ismas
@ -24,6 +24,43 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
|
|||||||
|
|
||||||
PERCENT=1
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
###########################################################################
|
###########################################################################
|
||||||
###########################################################################
|
###########################################################################
|
||||||
|
|
||||||
@ -317,109 +354,4 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
|
|||||||
reset_update_trigger
|
reset_update_trigger
|
||||||
return $?
|
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
|
fi
|
||||||
|
37
read_config
37
read_config
@ -33,7 +33,7 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|||||||
log_fatal "$func:${LINENO}: $WORKING_DIRECTORY not found"
|
log_fatal "$func:${LINENO}: $WORKING_DIRECTORY not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXITCODE=$RC_SUCCESS
|
EXITCODE=0
|
||||||
CLONE_CUSTOMER_REPOSITORY=false
|
CLONE_CUSTOMER_REPOSITORY=false
|
||||||
|
|
||||||
# read config file (JSON syntax)
|
# read config file (JSON syntax)
|
||||||
@ -118,17 +118,8 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|||||||
log_debug "$func:${LINENO}: $CUSTOMER_LOCATION_DIR"
|
log_debug "$func:${LINENO}: $CUSTOMER_LOCATION_DIR"
|
||||||
|
|
||||||
readonly UPDATE_CONF="${CUSTOMER_LOCATION_DIR}/update.conf"
|
readonly UPDATE_CONF="${CUSTOMER_LOCATION_DIR}/update.conf"
|
||||||
log_debug "$func:${LINENO}: UPDATE.CONF=$UPDATE_CONF"
|
log_debug "$func:${LINENO}: UPDATE.CONF="
|
||||||
|
log_debug "$func:${LINENO}: $UPDATE_CONF"
|
||||||
readonly DC="dc2c.hex"
|
|
||||||
readonly DC_SYS_DIR="/etc/dc"
|
|
||||||
readonly DC_DIR="${CUSTOMER_LOCATION_DIR}/dc"
|
|
||||||
readonly DC_FULL="${DC_DIR}/$DC"
|
|
||||||
if [ -f "$DC_FULL" ]; then
|
|
||||||
log_debug "$func:${LINENO}: d2dc.hex=$DC_FULL"
|
|
||||||
else
|
|
||||||
log_fatal "$func:${LINENO}: $DC_FULL does not exist"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# readonly zone_groups=(${__zone_groups[@]})
|
# readonly zone_groups=(${__zone_groups[@]})
|
||||||
# by now (03.03.2023) there is only one zone group.
|
# by now (03.03.2023) there is only one zone group.
|
||||||
@ -155,8 +146,8 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|||||||
# TODO
|
# TODO
|
||||||
# TODO: falls mehrere gruppen/zonen auftauchen hier anpassen
|
# TODO: falls mehrere gruppen/zonen auftauchen hier anpassen
|
||||||
# TODO
|
# TODO
|
||||||
readonly ZONE=1
|
readonly local __zone=1
|
||||||
readonly CUSTOMER_BASE_DIR="${CUSTOMER_BASE_DIRS[$ZONE]}"
|
readonly CUSTOMER_BASE_DIR="${CUSTOMER_BASE_DIRS[$__zone]}"
|
||||||
if [ -d "$CUSTOMER_BASE_DIR" ]; then
|
if [ -d "$CUSTOMER_BASE_DIR" ]; then
|
||||||
log_debug "$func:${LINENO}: CUSTOMER-BASE-DIR="
|
log_debug "$func:${LINENO}: CUSTOMER-BASE-DIR="
|
||||||
log_debug "$func:${LINENO}: $CUSTOMER_BASE_DIR"
|
log_debug "$func:${LINENO}: $CUSTOMER_BASE_DIR"
|
||||||
@ -218,15 +209,6 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|||||||
log_fatal "$func:${LINENO}: $psa_atbqt_dir does not exist"
|
log_fatal "$func:${LINENO}: $psa_atbqt_dir does not exist"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly TARIFF_CURRENT="tariff.current"
|
|
||||||
readonly TARIFF_CURRENT_FULL="${psa_atbqt_dir}/$TARIFF_CURRENT"
|
|
||||||
if [ -f "$TARIFF_CURRENT_FULL" ]; then
|
|
||||||
log_debug "$func:${LINENO}: tariff.current="
|
|
||||||
log_debug "$func:${LINENO}: $TARIFF_CURRENT_FULL"
|
|
||||||
else
|
|
||||||
log_fatal "$func:${LINENO}: $TARIFF_CURRENT_FULL does not exist"
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly ATBQT_INI="ATBQT.ini"
|
readonly ATBQT_INI="ATBQT.ini"
|
||||||
readonly ATBQT_INI_FULL="${psa_atbqt_dir}/$ATBQT_INI"
|
readonly ATBQT_INI_FULL="${psa_atbqt_dir}/$ATBQT_INI"
|
||||||
if [ -f "$ATBQT_INI_FULL" ]; then
|
if [ -f "$ATBQT_INI_FULL" ]; then
|
||||||
@ -235,15 +217,6 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|||||||
else
|
else
|
||||||
log_fatal "$func:${LINENO}: $ATBQT_INI_FULL does not exist"
|
log_fatal "$func:${LINENO}: $ATBQT_INI_FULL does not exist"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly ATBQT="ATBQT"
|
|
||||||
readonly ATBQT_SYS_FULL="${ATBAPP_SYS_DIR}/$ATBQT"
|
|
||||||
if [ -f "$ATBQT_SYS_FULL" ]; then
|
|
||||||
log_debug "$func:${LINENO}: ATBQT="
|
|
||||||
log_debug "$func:${LINENO}: $ATBQT_SYS_FULL"
|
|
||||||
else
|
|
||||||
log_fatal "$func:${LINENO}: $ATBQT_SYS_FULL does not exist"
|
|
||||||
fi
|
|
||||||
|
|
||||||
readonly ISMASMGR_INI="ISMASMgr.ini"
|
readonly ISMASMGR_INI="ISMASMgr.ini"
|
||||||
readonly ISMASMGR_SYS_DIR="/opt/app/ISMASMgr"
|
readonly ISMASMGR_SYS_DIR="/opt/app/ISMASMgr"
|
||||||
|
@ -30,10 +30,6 @@ while test $# -gt 0; do
|
|||||||
shift
|
shift
|
||||||
CONFIGFILENAME="$1"
|
CONFIGFILENAME="$1"
|
||||||
;;
|
;;
|
||||||
--zone | --zon | --zo | --z | -zone | -zon | -zo | -z )
|
|
||||||
shift
|
|
||||||
ZONE="$1"
|
|
||||||
;;
|
|
||||||
--wdir | --wdi | --wd | --w | -wdir | -wdi | -wd | -w )
|
--wdir | --wdi | --wd | --w | -wdir | -wdi | -wd | -w )
|
||||||
shift
|
shift
|
||||||
WORKING_DIRECTORY="$1"
|
WORKING_DIRECTORY="$1"
|
||||||
|
@ -8,15 +8,6 @@
|
|||||||
"" : "unique customer identifier",
|
"" : "unique customer identifier",
|
||||||
"customer_id" : "281",
|
"customer_id" : "281",
|
||||||
|
|
||||||
"" : "zone file for PSA",
|
|
||||||
"zone" : "/etc/zone_nr",
|
|
||||||
|
|
||||||
"" : "customer number of PSA",
|
|
||||||
"customer_id_" : "/etc/cust_nr",
|
|
||||||
|
|
||||||
"" : "machine id of PSA",
|
|
||||||
"machine_nr" : "/etc/mach_nr",
|
|
||||||
|
|
||||||
"" : "each location can have multiple",
|
"" : "each location can have multiple",
|
||||||
"" : "zone-groups and/or zones",
|
"" : "zone-groups and/or zones",
|
||||||
"" : "0-index used as size of following array",
|
"" : "0-index used as size of following array",
|
||||||
|
@ -51,11 +51,7 @@ copy () {
|
|||||||
local __m=""
|
local __m=""
|
||||||
local __copy_error=0
|
local __copy_error=0
|
||||||
|
|
||||||
if grep -qE "^.*$DC\s*$" <<< ${f}; then
|
if grep -qE "^.*[.]json\s*$" <<< ${f}; then
|
||||||
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${DC_SYS_DIR}/${__f}"
|
|
||||||
cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${DC_SYS_DIR}/${__f}"
|
|
||||||
__copy_error=$?
|
|
||||||
elif grep -qE "^.*[.]json\s*$" <<< ${f}; then
|
|
||||||
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${CONF_SYS_DIR}/${__f}"
|
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${CONF_SYS_DIR}/${__f}"
|
||||||
cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${CONF_SYS_DIR}/${__f}"
|
cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${CONF_SYS_DIR}/${__f}"
|
||||||
__copy_error=$?
|
__copy_error=$?
|
||||||
@ -109,14 +105,14 @@ copy () {
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
filter_changed_files () {
|
filter_json_ini_files () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
log_debug "$func:${LINENO} $1"
|
log_debug "$func:${LINENO} $1"
|
||||||
readarray -td' ' files <<< "$1"
|
readarray -td' ' files <<< "$1"
|
||||||
local __system_files=""
|
local __system_files=""
|
||||||
for f in ${files[@]}; do
|
for f in ${files[@]}; do
|
||||||
log_debug "$func:${LINENO} $f"
|
log_debug "$func:${LINENO} $f"
|
||||||
if grep -qE "^.*[.]($2)\s*$" <<< $f; then
|
if grep -qE "^.*[.](json|ini)\s*$" <<< $f; then
|
||||||
if [ -z $__system_files ]; then
|
if [ -z $__system_files ]; then
|
||||||
__system_files="${f}"
|
__system_files="${f}"
|
||||||
else
|
else
|
||||||
@ -146,49 +142,47 @@ check_md5_for_changed_json_and_ini_files () {
|
|||||||
log_debug "$func:${LINENO} files=$1"
|
log_debug "$func:${LINENO} files=$1"
|
||||||
if ! [ -z $1 ]; then
|
if ! [ -z $1 ]; then
|
||||||
readarray -td' ' files <<< "$1"
|
readarray -td' ' files <<< "$1"
|
||||||
local readonly __cl=$CUSTOMER_LOCATION
|
|
||||||
for file in ${files[@]}; do
|
for file in ${files[@]}; do
|
||||||
log_debug "$func:${LINENO} checking file=${file}..."
|
log_debug "$func:${LINENO} checking file=${file}..."
|
||||||
local __fsuffix=${file##*.}
|
local __fsuffix=${file##*.}
|
||||||
local __bn=$(basename $file .$__fsuffix)
|
local __bn=$(basename $file .$__fsuffix)
|
||||||
if [[ "$file" =~ .*dc2c.hex.* ]]; then
|
if [[ "$file" =~ .*cash[.]json.* ]]; then
|
||||||
js_key=".dc.dc2c.$__bn"
|
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.$__bn"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
|
||||||
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
|
||||||
elif [[ "$file" =~ .*cash[.]json.* ]]; then
|
|
||||||
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.$__bn"
|
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
||||||
elif [[ "$file" =~ .*print[0-9][0-9][.]json.* ]]; then
|
elif [[ "$file" =~ .*print[0-9][0-9][.]json.* ]]; then
|
||||||
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.$__bn"
|
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.$__bn"
|
||||||
|
|
||||||
|
echo "$js_key"
|
||||||
|
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
||||||
elif [[ "$file" =~ .*conf[.]json.* ]]; then
|
elif [[ "$file" =~ .*conf[.]json.* ]]; then
|
||||||
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.DC2C_conf"
|
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.DC2C_conf"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
||||||
elif [[ "$file" =~ .*serial[.]json.* ]]; then
|
elif [[ "$file" =~ .*serial[.]json.* ]]; then
|
||||||
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.DC2C_serial"
|
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.DC2C_serial"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
|
||||||
elif [[ "$file" =~ .*ATBQT[.]ini.* ]]; then
|
elif [[ "$file" =~ .*ATBQT[.]ini.* ]]; then
|
||||||
js_key=".ini.$__cl.zg[1].z[1].opt.app.ATBAPP.ATBQT"
|
js_key=".ini.szeged.zg[1].z[1].opt.app.ATBAPP.ATBQT"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository="$(md5_of $ATBQT_INI_FULL)"
|
md5sum_repository="$(md5_of $ATBQT_INI_FULL)"
|
||||||
elif [[ "$file" =~ .*sysconfig[.]ini.* ]]; then
|
elif [[ "$file" =~ .*sysconfig[.]ini.* ]]; then
|
||||||
js_key=".ini.$__cl.zg[1].z[1].opt.app.sysconfig.sysconfig"
|
js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.sysconfig"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository=$(md5_of $SYSCONFIG_SYSCONFIG_INI_FULL)
|
md5sum_repository=$(md5_of $SYSCONFIG_SYSCONFIG_INI_FULL)
|
||||||
elif [[ "$file" =~ .*SystemControl[.]ini.* ]]; then
|
elif [[ "$file" =~ .*SystemControl[.]ini.* ]]; then
|
||||||
js_key=".ini.$__cl.zg[1].z[1].opt.app.sysconfig.SystemControl"
|
js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.SystemControl"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository=$(md5_of $SYSCONFIG_SYSCTRL_INI_FULL)
|
md5sum_repository=$(md5_of $SYSCONFIG_SYSCTRL_INI_FULL)
|
||||||
elif [[ "$file" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then
|
elif [[ "$file" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then
|
||||||
js_key=".ini.$__cl.zg[1].z[1].opt.app.ISMASMgr.ISMASMgr"
|
js_key=".ini.szeged.zg[1].z[1].opt.app.ISMASMgr.ISMASMgr"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository=$(md5_of $ISMASMGR_ISMASMGR_INI_FULL)
|
md5sum_repository=$(md5_of $ISMASMGR_ISMASMGR_INI_FULL)
|
||||||
elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then
|
elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then
|
||||||
js_key=".ini.$__cl.zg[1].z[1].opt.app.sysconfig.ISMASMgr"
|
js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.ISMASMgr"
|
||||||
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
|
||||||
md5sum_repository=$(md5_of $SYSCONFIG_ISMASMGR_INI_FULL)
|
md5sum_repository=$(md5_of $SYSCONFIG_ISMASMGR_INI_FULL)
|
||||||
else
|
else
|
||||||
@ -372,22 +366,3 @@ check_for_apism () {
|
|||||||
nc localhost 7778
|
nc localhost 7778
|
||||||
}
|
}
|
||||||
|
|
||||||
get_plugins () {
|
|
||||||
local __plugins=""
|
|
||||||
for __f in /opt/app/ATBAPP/plugins/*; do
|
|
||||||
local plugin=$__f
|
|
||||||
plugins+="
|
|
||||||
\"${plugin##*/}\": {
|
|
||||||
"
|
|
||||||
plugins+=$(strings $__f |
|
|
||||||
grep -A4 \"Interface\": |
|
|
||||||
grep \"Version\" |
|
|
||||||
sed -E -e 's/^\s*/\n/g')
|
|
||||||
# remove trailing ',' which is already contained in returned value
|
|
||||||
plugins=${plugins/%,}
|
|
||||||
plugins+="
|
|
||||||
},"
|
|
||||||
done
|
|
||||||
printf '%s' ${plugins/%,}
|
|
||||||
}
|
|
||||||
# get_plugins
|
|
||||||
|
@ -12,19 +12,20 @@ trap collect_current_configuration EXIT
|
|||||||
|
|
||||||
collect_current_configuration () {
|
collect_current_configuration () {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
|
echo $func
|
||||||
|
|
||||||
current_settings_to_ismas
|
return 0
|
||||||
|
|
||||||
#for line in $(cat $UPDATE_CONF |\
|
for line in $(cat $UPDATE_CONF |\
|
||||||
# jq -r .conf.szeged.zg[1].z[1].etc.psa_config)
|
jq -r .conf.szeged.zg[1].z[1].etc.psa_config)
|
||||||
#do
|
do
|
||||||
# conf_file="$(echo $line |
|
conf_file="$(echo $line |
|
||||||
# sed -E -ne 's/^[^{}]\s+\"(DC2C_[[:alnum:]]+)\".*$/\1/gp')"
|
sed -E -ne 's/^[^{}]\s+\"(DC2C_[[:alnum:]]+)\".*$/\1/gp')"
|
||||||
# if ! [ -z $conf_file ]; then
|
if ! [ -z $conf_file ]; then
|
||||||
# local v=$(cat "$psa_config_dir/${conf_file}.json" | jq -r .version)
|
local v=$(cat "$psa_config_dir/${conf_file}.json" | jq -r .version)
|
||||||
# echo "$conf_file.json version=$v"
|
echo "$conf_file.json version=$v"
|
||||||
# fi
|
fi
|
||||||
#done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
update_psa() {
|
update_psa() {
|
||||||
@ -86,20 +87,20 @@ update_psa() {
|
|||||||
# dateinen zu ueberpruefen
|
# dateinen zu ueberpruefen
|
||||||
|
|
||||||
local changed_files=$(changed_file_names)
|
local changed_files=$(changed_file_names)
|
||||||
local files_to_copy=$(filter_changed_files "$changed_files" 'json|ini|hex')
|
local json_ini_files=$(filter_json_ini_files "$changed_files")
|
||||||
|
|
||||||
update_psa_report_changed_file_names $changed_files # message to ISMAS
|
update_psa_report_changed_file_names $changed_files # message to ISMAS
|
||||||
|
|
||||||
# check if *.conf and/or *.ini-files have to md5-sum as denoted
|
# check if *.conf and/or *.ini-files have to md5-sum as denoted
|
||||||
# in update.conf
|
# in update.conf
|
||||||
if ! check_md5_for_changed_json_and_ini_files "$files_to_copy" ; then
|
if ! check_md5_for_changed_json_and_ini_files "$json_ini_files" ; then
|
||||||
local __r=$?
|
local __r=$?
|
||||||
log_error "$func:${LINENO}: new customer files wrong"
|
log_error "$func:${LINENO}: new customer files wrong"
|
||||||
revert_customer_repository
|
revert_customer_repository
|
||||||
exit $__r
|
exit $__r
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! check_hardware_compatibility "$files_to_copy" ; then
|
if ! check_hardware_compatibility "$json_ini_files" ; then
|
||||||
local __r=$?
|
local __r=$?
|
||||||
log_error "$func:${LINENO}: json/ini-files not fit for PSA"
|
log_error "$func:${LINENO}: json/ini-files not fit for PSA"
|
||||||
revert_customer_repository
|
revert_customer_repository
|
||||||
@ -107,7 +108,7 @@ update_psa() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# copy *.conf and/or *.ini-files to their corresponding system-directories
|
# copy *.conf and/or *.ini-files to their corresponding system-directories
|
||||||
if ! copy $files_to_copy; then
|
if ! copy $json_ini_files; then
|
||||||
local __r=$?
|
local __r=$?
|
||||||
log_error "$func:${LINENO}: copy operation failed"
|
log_error "$func:${LINENO}: copy operation failed"
|
||||||
revert_customer_repository
|
revert_customer_repository
|
||||||
@ -167,9 +168,20 @@ update_psa() {
|
|||||||
log_error "$func:${LINENO}: cleanup_previous_version failed"
|
log_error "$func:${LINENO}: cleanup_previous_version failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# TODO: nach (erfolgreichem) abschluss sollte man immer das aktuelle setting
|
||||||
|
# ans ISMAS schicken. ISMAS sollte immer wissen, was gerade auf dem
|
||||||
|
# Automaten steht.
|
||||||
|
|
||||||
update_psa_cleanup $UPDATE_ISMAS_PROGRESS \
|
update_psa_cleanup $UPDATE_ISMAS_PROGRESS \
|
||||||
$RC_SUCCESS "cleanup after psa update"
|
$RC_SUCCESS "cleanup after psa update"
|
||||||
|
|
||||||
|
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"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user