From 1ad3b7e68fd92faaee0aca749b2b6311cecfe5de Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 2 Jun 2022 21:52:48 +0200 Subject: [PATCH] Added handling for DC --- update_psa_helpers | 57 +++++++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/update_psa_helpers b/update_psa_helpers index 96b07eb..1160d2a 100755 --- a/update_psa_helpers +++ b/update_psa_helpers @@ -51,7 +51,11 @@ copy () { local __m="" local __copy_error=0 - if grep -qE "^.*[.]json\s*$" <<< ${f}; then + if grep -qE "^.*$DC\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}" cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${CONF_SYS_DIR}/${__f}" __copy_error=$? @@ -105,14 +109,14 @@ copy () { return 0 } -filter_json_ini_files () { +filter_changed_files () { local func="${FUNCNAME[0]}" log_debug "$func:${LINENO} $1" readarray -td' ' files <<< "$1" local __system_files="" for f in ${files[@]}; do log_debug "$func:${LINENO} $f" - if grep -qE "^.*[.](json|ini)\s*$" <<< $f; then + if grep -qE "^.*[.]($2)\s*$" <<< $f; then if [ -z $__system_files ]; then __system_files="${f}" else @@ -142,47 +146,49 @@ check_md5_for_changed_json_and_ini_files () { log_debug "$func:${LINENO} files=$1" if ! [ -z $1 ]; then readarray -td' ' files <<< "$1" + local readonly __cl=$CUSTOMER_LOCATION for file in ${files[@]}; do log_debug "$func:${LINENO} checking file=${file}..." local __fsuffix=${file##*.} local __bn=$(basename $file .$__fsuffix) - if [[ "$file" =~ .*cash[.]json.* ]]; then - js_key=".conf.szeged.zg[1].z[1].etc.psa_config.$__bn" + if [[ "$file" =~ .*dc2c.hex.* ]]; then + js_key=".dc.dc2c.$__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_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)" elif [[ "$file" =~ .*print[0-9][0-9][.]json.* ]]; then - js_key=".conf.szeged.zg[1].z[1].etc.psa_config.$__bn" - - echo "$js_key" - + js_key=".conf.$__cl.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" =~ .*conf[.]json.* ]]; then - js_key=".conf.szeged.zg[1].z[1].etc.psa_config.DC2C_conf" + js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.DC2C_conf" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)" elif [[ "$file" =~ .*serial[.]json.* ]]; then - js_key=".conf.szeged.zg[1].z[1].etc.psa_config.DC2C_serial" + js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.DC2C_serial" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)" elif [[ "$file" =~ .*ATBQT[.]ini.* ]]; then - js_key=".ini.szeged.zg[1].z[1].opt.app.ATBAPP.ATBQT" + js_key=".ini.$__cl.zg[1].z[1].opt.app.ATBAPP.ATBQT" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository="$(md5_of $ATBQT_INI_FULL)" elif [[ "$file" =~ .*sysconfig[.]ini.* ]]; then - js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.sysconfig" + js_key=".ini.$__cl.zg[1].z[1].opt.app.sysconfig.sysconfig" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $SYSCONFIG_SYSCONFIG_INI_FULL) elif [[ "$file" =~ .*SystemControl[.]ini.* ]]; then - js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.SystemControl" + js_key=".ini.$__cl.zg[1].z[1].opt.app.sysconfig.SystemControl" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $SYSCONFIG_SYSCTRL_INI_FULL) elif [[ "$file" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then - js_key=".ini.szeged.zg[1].z[1].opt.app.ISMASMgr.ISMASMgr" + js_key=".ini.$__cl.zg[1].z[1].opt.app.ISMASMgr.ISMASMgr" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $ISMASMGR_ISMASMGR_INI_FULL) elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then - js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.ISMASMgr" + js_key=".ini.$__cl.zg[1].z[1].opt.app.sysconfig.ISMASMgr" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $SYSCONFIG_ISMASMGR_INI_FULL) else @@ -366,3 +372,22 @@ check_for_apism () { 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