From 7e8d49c29801d49b34886a403bfbb02427c29487 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 3 Jun 2022 19:27:28 +0200 Subject: [PATCH] Fixed copy() to handle ATBQT.ini. Renamed filter_system_files() to fileter_conf_ini_files() --- update_psa_helpers | 56 +++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/update_psa_helpers b/update_psa_helpers index 66b1829..db4ab24 100755 --- a/update_psa_helpers +++ b/update_psa_helpers @@ -36,21 +36,30 @@ copy () { readarray -td' ' files <<< "$1" for f in ${files[@]}; do - if [ "$f" = "update.conf" ] || [ "$f" = "current.conf" ]; then + if [[ "$f" =~ .*update[.]conf.* ]] || [[ "$f" =~ .*current[.]conf.* ]] + then continue fi if grep -qE "^.*[.]conf\s*$" <<< ${f}; then - local __f="${psa_config_dir}/${f}" - if ! cp ${__f} /etc/psa_config; then - log_error "$func:${LINENO}: cannot cp ${__f} /etc/psa_config" + local __f=${f#*etc/} + if ! cp "${customer_id_base_dir}/${f}" "/etc/${__f}"; then + log_error "$func:${LINENO}: cannot "\ + "cp ${customer_id_base_dir}/${f} /etc/${__f}" return 1 fi - log_info "$func:${LINENO}: copied $f to /etc/psa_config" + log_info "$func:${LINENO}: copied $f to /etc/${__f}" elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then - # TODO - set -x - : - set +x + # TODO: die anderen system-verzeichnisse werden gebraucht + local __f=${f#*opt/app/ATBAPP/} + if [ "$__f" = "ATBQT.ini" ]; then + if ! cp "${customer_id_base_dir}/${f}" /opt/app/ATBAPP/${__f} + then + log_error "$func:${LINENO}: cannot "\ + "cp ${customer_id_base_dir}/${f} /opt/app/ATBAPP/${__f}" + return 1 + fi + fi + log_info "$func:${LINENO}: copied $f to /opt/app/ATBAPP/${__f}" fi done @@ -58,7 +67,7 @@ copy () { return 0; } -filter_system_files () { +filter_conf_ini_files () { local func="${FUNCNAME[0]}" log_debug "$func:${LINENO} $1" readarray -td' ' files <<< "$1" @@ -96,44 +105,35 @@ check_md5_for_changed_conf_and_ini_files () { readarray -td' ' files <<< "$1" for file in ${files[@]}; do log_debug "$func:${LINENO} file=$file" - if [ "$file" = "emp.conf" ]; then + if [[ "$file" =~ .*emp[.]conf.* ]]; then js_key=".conf.szeged.zg[1].z[1].etc.psa_config.emp" md5sum_update_conf=$(cat $update_conf | jq -r $js_key) md5sum_repository="$(md5_of $emp_conf)" - elif [ "$file" = "printer.conf" ]; then + elif [[ "$file" =~ .*printer[.]conf.* ]]; then js_key=".conf.szeged.zg[1].z[1].etc.psa_config.printer" md5sum_update_conf=$(cat $update_conf | jq -r $js_key) md5sum_repository="$(md5_of $printer_conf)" - elif [ "$file" = "device.conf" ]; then + elif [[ "$file" =~ .*device[.]conf.* ]]; then js_key=".conf.szeged.zg[1].z[1].etc.psa_config.device" md5sum_update_conf=$(cat $update_conf | jq -r $js_key) md5sum_repository="$(md5_of $device_conf)" - elif [ "$file" = "ATBQT.ini" ]; then - js_key=".ini.szeged.zg[1].z[1].opt.app.ATBQT.ATBQT" + 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) md5sum_repository="$(md5_of $atbqt_ini)" - elif [ "$file" = "sysconfig.ini" ]; then + elif [[ "$file" =~ .*sysconfig[.]ini.* ]]; then js_key=".ini.szeged.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) - elif [ "$file" = "SystemControl.ini" ]; then + elif [[ "$file" =~ .*SystemControl[.]ini.* ]]; then js_key=".ini.szeged.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) - elif [ "$file" = "ISMASMgr.ini" ]; then + elif [[ "$file" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then js_key=".ini.szeged.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) - if [ "$md5sum_repository" = "$md5sum_update_conf" ]; then - log_info "$func:${LINENO}: md5sum for $file ok" - else - local __r="repository: $md5sum_repository" - local __u="update.conf=$md5sum_update_conf" - local __m="$__r != $__u" - log_error "$func:${LINENO}: md5sum for $file wrong: $__m" - return 1 - fi - + elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then js_key=".ini.szeged.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)