From 2158f65c65f4401d17f253bcb5ec6465a8d399dd Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 6 Jun 2022 19:04:09 +0200 Subject: [PATCH] removed current.conf. using .json instead of .conf --- update_psa_helpers | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/update_psa_helpers b/update_psa_helpers index 55c45f5..96b07eb 100755 --- a/update_psa_helpers +++ b/update_psa_helpers @@ -38,8 +38,7 @@ copy () { for f in ${files[@]}; do log_debug "$func:${LINENO}: $f" # $f is determined by git - if [[ "$f" =~ .*update[.]conf.* ]] || [[ "$f" =~ .*current[.]conf.* ]] - then + if [[ "$f" =~ .*update[.]conf.* ]]; then continue fi @@ -52,7 +51,7 @@ copy () { local __m="" local __copy_error=0 - if grep -qE "^.*[.]conf\s*$" <<< ${f}; then + if 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=$? @@ -98,7 +97,7 @@ copy () { if [ $copy_necessary -eq 0 ]; then update_psa_copy_conf_and_ini_files $UPDATE_ISMAS_PROGRESS $RC_SUCCESS \ - "no copy of conf/ini-files necessary" + "no copy of json/ini-files necessary" log_debug "$func:${LINENO}: no copy of conf/ini-files necessary" else log_debug "$func:${LINENO}: copied *conf/*ini-files to system-dirs" @@ -106,14 +105,14 @@ copy () { return 0 } -filter_conf_ini_files () { +filter_json_ini_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 "^.*[.](conf|ini)\s*$" <<< $f; then + if grep -qE "^.*[.](json|ini)\s*$" <<< $f; then if [ -z $__system_files ]; then __system_files="${f}" else @@ -134,7 +133,7 @@ md5_of () { # Check if the fetched/merged files have the correct md5 and are # valid for the PSA. # -check_md5_for_changed_conf_and_ini_files () { +check_md5_for_changed_json_and_ini_files () { local func="${FUNCNAME[0]}" local js_key="" # used by json-parser 'jq' local md5sum_update_conf="" @@ -145,18 +144,27 @@ check_md5_for_changed_conf_and_ini_files () { readarray -td' ' files <<< "$1" for file in ${files[@]}; do log_debug "$func:${LINENO} checking file=${file}..." - if [[ "$file" =~ .*emp[.]conf.* ]]; then - js_key=".conf.szeged.zg[1].z[1].etc.psa_config.emp" + 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" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) - md5sum_repository="$(md5_of $emp_conf)" - elif [[ "$file" =~ .*printer[.]conf.* ]]; then - js_key=".conf.szeged.zg[1].z[1].etc.psa_config.printer" + 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" + md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) - md5sum_repository="$(md5_of $printer_conf)" - elif [[ "$file" =~ .*device[.]conf.* ]]; then - js_key=".conf.szeged.zg[1].z[1].etc.psa_config.device" + 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" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) - md5sum_repository="$(md5_of $device_conf)" + 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" + 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" md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)