Fixed copy() to handle ATBQT.ini. Renamed filter_system_files() to fileter_conf_ini_files()

This commit is contained in:
Gerhard Hoffmann 2022-06-03 19:27:28 +02:00
parent 014026a3e9
commit 7e8d49c298

View File

@ -36,21 +36,30 @@ copy () {
readarray -td' ' files <<< "$1" readarray -td' ' files <<< "$1"
for f in ${files[@]}; do for f in ${files[@]}; do
if [ "$f" = "update.conf" ] || [ "$f" = "current.conf" ]; then if [[ "$f" =~ .*update[.]conf.* ]] || [[ "$f" =~ .*current[.]conf.* ]]
then
continue continue
fi fi
if grep -qE "^.*[.]conf\s*$" <<< ${f}; then if grep -qE "^.*[.]conf\s*$" <<< ${f}; then
local __f="${psa_config_dir}/${f}" local __f=${f#*etc/}
if ! cp ${__f} /etc/psa_config; then if ! cp "${customer_id_base_dir}/${f}" "/etc/${__f}"; then
log_error "$func:${LINENO}: cannot cp ${__f} /etc/psa_config" log_error "$func:${LINENO}: cannot "\
"cp ${customer_id_base_dir}/${f} /etc/${__f}"
return 1 return 1
fi 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 elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then
# TODO # TODO: die anderen system-verzeichnisse werden gebraucht
set -x local __f=${f#*opt/app/ATBAPP/}
: if [ "$__f" = "ATBQT.ini" ]; then
set +x 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 fi
done done
@ -58,7 +67,7 @@ copy () {
return 0; return 0;
} }
filter_system_files () { filter_conf_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"
@ -96,44 +105,35 @@ check_md5_for_changed_conf_and_ini_files () {
readarray -td' ' files <<< "$1" readarray -td' ' files <<< "$1"
for file in ${files[@]}; do for file in ${files[@]}; do
log_debug "$func:${LINENO} file=$file" 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" js_key=".conf.szeged.zg[1].z[1].etc.psa_config.emp"
md5sum_update_conf=$(cat $update_conf | jq -r $js_key) md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
md5sum_repository="$(md5_of $emp_conf)" 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" js_key=".conf.szeged.zg[1].z[1].etc.psa_config.printer"
md5sum_update_conf=$(cat $update_conf | jq -r $js_key) md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
md5sum_repository="$(md5_of $printer_conf)" 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" js_key=".conf.szeged.zg[1].z[1].etc.psa_config.device"
md5sum_update_conf=$(cat $update_conf | jq -r $js_key) md5sum_update_conf=$(cat $update_conf | jq -r $js_key)
md5sum_repository="$(md5_of $device_conf)" md5sum_repository="$(md5_of $device_conf)"
elif [ "$file" = "ATBQT.ini" ]; then elif [[ "$file" =~ .*ATBQT[.]ini.* ]]; then
js_key=".ini.szeged.zg[1].z[1].opt.app.ATBQT.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)" 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" 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) 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" 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) 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" 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) md5sum_repository=$(md5_of $ismasmgr_ismasmgr_ini)
if [ "$md5sum_repository" = "$md5sum_update_conf" ]; then elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; 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
js_key=".ini.szeged.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) md5sum_repository=$(md5_of $sysconfig_ismasmgr_ini)