Added handling for ini-files in /etc/atb in copy() and chaeck_md5_for_json_and_ini_files()

This commit is contained in:
Gerhard Hoffmann 2022-06-05 15:31:10 +02:00
parent 39dea2f43f
commit 4a0b0896bb

View File

@ -47,55 +47,64 @@ copy () {
PERCENT=$((PERCENT+1)) PERCENT=$((PERCENT+1))
test $PERCENT -gt 100 && PERCENT=100 test $PERCENT -gt 100 && PERCENT=100
local __f=${f##*/} local readonly __f=${f##*/}
local __m="" local readonly __m="${CUSTOMER_ID_BASE_DIR}/${f}"
local __copy_error=0 local __p=""
if grep -qE "^.*$DC\s*$" <<< ${f}; then if grep -qE "^.*$DC\s*$" <<< ${f}; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${DC_SYS_DIR}/${__f}" __p=" ${DC_SYS_DIR}/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${DC_SYS_DIR}/${__f}" log_debug "$func:${LINENO}: __m=$__m"
__copy_error=$?
elif grep -qE "^.*[.]json\s*$" <<< ${f}; then elif grep -qE "^.*[.]json\s*$" <<< ${f}; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${CONF_SYS_DIR}/${__f}" __p=" ${CONF_SYS_DIR}/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${CONF_SYS_DIR}/${__f}" log_debug "$func:${LINENO}: __m=$__m"
__copy_error=$?
elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then
if [ "$__f" = "$ATBQT_INI" ]; then if [ "$__f" = "$ATBQT_INI" ]; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} $ATBAPP_SYS_DIR/${__f}" log_debug "$func:${LINENO}: __m=$__m $ATB_SYS_DIR/$__f ${f%/*}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $ATBAPP_SYS_DIR/${__f} if grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
__copy_error=$? __p="$ATB_SYS_DIR/${__f}"
else
__p="$ATBAPP_SYS_DIR/${__f}"
fi
elif [ "$__f" = "$SYSTEM_CONTROL_INI" ]; then elif [ "$__f" = "$SYSTEM_CONTROL_INI" ]; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} $SYSCONFIG_SYS_DIR/${__f}" if grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $SYSCONFIG_SYS_DIR/${__f} __p="$ATB_SYS_DIR/${__f}"
__copy_error=$? else
__p="$SYSCONFIG_SYS_DIR/${__f}"
fi
elif [ "$__f" = "$SYS_CONFIG_INI" ]; then elif [ "$__f" = "$SYS_CONFIG_INI" ]; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} $SYSCONFIG_SYS_DIR/${__f}" if grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $SYSCONFIG_SYS_DIR/${__f} __p="$ATB_SYS_DIR/${__f}"
__copy_error=$? else
__p="$SYSCONFIG_SYS_DIR/${__f}"
fi
elif [ "$__f" = "$ISMASMGR_INI" ]; then elif [ "$__f" = "$ISMASMGR_INI" ]; then
if grep -qE "$ISMASMGR_SYS_DIR" <<< "${f%/*}"; then if grep -qE "$ISMASMGR_SYS_DIR" <<< "${f%/*}"; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f}" __p="$ISMASMGR_SYS_DIR/${__f}"
__m="$__m $ISMASMGR_SYS_DIR/${__f}" elif grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $ISMASMGR_SYS_DIR/${__f} __p="$ATB_SYS_DIR/${__f}"
__copy_error=$?
else else
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f}" __p="$SYSCONFIG_SYS_DIR/${__f}"
__m="$__m $SYSCONFIG_SYS_DIR/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $SYSCONFIG_SYS_DIR/${__f}
__copy_error=$?
fi fi
fi fi
fi fi
if [ $__copy_error -ne 0 ]; then if [ ! -z "$__p" ]; then
log_error "$func:${LINENO}: $__m failed" if cp "$__m" "$__p"; then
update_psa_copy_conf_and_ini_files \ log_info "$func:${LINENO}: cp $__m $__p ok"
$UPDATE_ISMAS_ERROR $RC_COPY_ERROR "$__m failed"
return $?
else
log_info "$func:${LINENO}: $__m ok"
update_psa_copy_conf_and_ini_files $UPDATE_ISMAS_PROGRESS \ update_psa_copy_conf_and_ini_files $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "$__m ok" $RC_SUCCESS "cp $__m $__p ok"
else
log_error "$func:${LINENO}: cp $__m $__p failed: error-code=$?"
update_psa_copy_conf_and_ini_files \
$UPDATE_ISMAS_ERROR $RC_COPY_ERROR "cp $__m $__p failed"
return $?
fi
else
log_error "$func:${LINENO}: __p still empty"
update_psa_copy_conf_and_ini_files \
$UPDATE_ISMAS_ERROR $RC_COPY_ERROR "__p still empty"
EXITCODE=$((EXITCODE+1))
return $EXITCODE
fi fi
done done
@ -106,6 +115,7 @@ copy () {
else else
log_debug "$func:${LINENO}: copied *conf/*ini-files to system-dirs" log_debug "$func:${LINENO}: copied *conf/*ini-files to system-dirs"
fi fi
return 0 return 0
} }
@ -171,18 +181,34 @@ check_md5_for_changed_json_and_ini_files () {
js_key=".conf.$__cl.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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)" md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
elif [[ "$file" =~ .*atb/ATBQT[.]ini.* ]]; then
js_key=".ini.$__cl.zg[1].z[1].etc.atb.ATBQT"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $ATB_ATBQT_INI_FULL)"
elif [[ "$file" =~ .*ATBQT[.]ini.* ]]; then elif [[ "$file" =~ .*ATBQT[.]ini.* ]]; then
js_key=".ini.$__cl.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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $ATBQT_INI_FULL)" md5sum_repository="$(md5_of $ATBQT_INI_FULL)"
elif [[ "$file" =~ .*atb/sysconfig[.]ini.* ]]; then
js_key=".ini.$__cl.zg[1].z[1].etc.atb.sysconfig"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $ATB_SYSCONFIG_INI_FULL)"
elif [[ "$file" =~ .*sysconfig[.]ini.* ]]; then elif [[ "$file" =~ .*sysconfig[.]ini.* ]]; then
js_key=".ini.$__cl.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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository=$(md5_of $SYSCONFIG_SYSCONFIG_INI_FULL) md5sum_repository=$(md5_of $SYSCONFIG_SYSCONFIG_INI_FULL)
elif [[ "$file" =~ .*atb/SystemControl[.]ini.* ]]; then
js_key=".ini.$__cl.zg[1].z[1].etc.atb.SystemControl"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $ATB_SYSCTRL_INI_FULL)"
elif [[ "$file" =~ .*SystemControl[.]ini.* ]]; then elif [[ "$file" =~ .*SystemControl[.]ini.* ]]; then
js_key=".ini.$__cl.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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository=$(md5_of $SYSCONFIG_SYSCTRL_INI_FULL) md5sum_repository=$(md5_of $SYSCONFIG_SYSCTRL_INI_FULL)
elif [[ "$file" =~ .*atb/ISMASMgr[.]ini.* ]]; then
js_key=".ini.$__cl.zg[1].z[1].etc.atb.ISMASMgr"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $ATB_ISMASMGR_INI_FULL)"
elif [[ "$file" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then elif [[ "$file" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then
js_key=".ini.$__cl.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_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)