From f9276b3fdb012682dd91985a0701f3961e097947 Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Fri, 3 Jun 2022 21:50:15 +0200 Subject: [PATCH] use of capitalized global variables; added check_for_apism() --- update_psa_helpers | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/update_psa_helpers b/update_psa_helpers index db4ab24..ff9479e 100755 --- a/update_psa_helpers +++ b/update_psa_helpers @@ -42,9 +42,9 @@ copy () { fi if grep -qE "^.*[.]conf\s*$" <<< ${f}; then local __f=${f#*etc/} - if ! cp "${customer_id_base_dir}/${f}" "/etc/${__f}"; then + if ! cp "${CUSTOMER_ID_BASE_DIR}/${f}" "/etc/${__f}"; then log_error "$func:${LINENO}: cannot "\ - "cp ${customer_id_base_dir}/${f} /etc/${__f}" + "cp ${CUSTOMER_ID_BASE_DIR}/${f} /etc/${__f}" return 1 fi log_info "$func:${LINENO}: copied $f to /etc/${__f}" @@ -52,10 +52,10 @@ copy () { # 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} + 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}" + "cp ${CUSTOMER_ID_BASE_DIR}/${f} /opt/app/ATBAPP/${__f}" return 1 fi fi @@ -107,35 +107,35 @@ check_md5_for_changed_conf_and_ini_files () { log_debug "$func:${LINENO} file=$file" 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_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_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)" 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_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.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)" 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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $sysconfig_sysconfig_ini) 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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $sysconfig_sysctrl_ini) 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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $ismasmgr_ismasmgr_ini) 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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key) md5sum_repository=$(md5_of $sysconfig_ismasmgr_ini) else continue @@ -174,7 +174,7 @@ check_md5_for_opkg_packages () { fi done - local __update_conf="${customer_location_dir}/update.conf" + local __update_conf="${CUSTOMER_LOCATION_DIR}/update.conf" md5sum_repo=$(cat $__update_conf | jq -r .opkg.${package}.MD5Sum) if ! [ -z $md5sum_repo ]; then if [ "$md5sum_opkg_info" = "$md5sum_repo" ]; then @@ -294,3 +294,13 @@ cleanup_previous_version() { local func="${FUNCNAME[0]}" return 0 } + +check_for_apism () { + nc localhost 7778 + if [ $? -eq 0 ] + then + return 0 + fi + return 1 +} +