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))
test $PERCENT -gt 100 && PERCENT=100
local __f=${f##*/}
local __m=""
local __copy_error=0
local readonly __f=${f##*/}
local readonly __m="${CUSTOMER_ID_BASE_DIR}/${f}"
local __p=""
if grep -qE "^.*$DC\s*$" <<< ${f}; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${DC_SYS_DIR}/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${DC_SYS_DIR}/${__f}"
__copy_error=$?
__p=" ${DC_SYS_DIR}/${__f}"
log_debug "$func:${LINENO}: __m=$__m"
elif 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=$?
__p=" ${CONF_SYS_DIR}/${__f}"
log_debug "$func:${LINENO}: __m=$__m"
elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then
if [ "$__f" = "$ATBQT_INI" ]; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} $ATBAPP_SYS_DIR/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $ATBAPP_SYS_DIR/${__f}
__copy_error=$?
log_debug "$func:${LINENO}: __m=$__m $ATB_SYS_DIR/$__f ${f%/*}"
if grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
__p="$ATB_SYS_DIR/${__f}"
else
__p="$ATBAPP_SYS_DIR/${__f}"
fi
elif [ "$__f" = "$SYSTEM_CONTROL_INI" ]; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} $SYSCONFIG_SYS_DIR/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $SYSCONFIG_SYS_DIR/${__f}
__copy_error=$?
if grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
__p="$ATB_SYS_DIR/${__f}"
else
__p="$SYSCONFIG_SYS_DIR/${__f}"
fi
elif [ "$__f" = "$SYS_CONFIG_INI" ]; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} $SYSCONFIG_SYS_DIR/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $SYSCONFIG_SYS_DIR/${__f}
__copy_error=$?
if grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
__p="$ATB_SYS_DIR/${__f}"
else
__p="$SYSCONFIG_SYS_DIR/${__f}"
fi
elif [ "$__f" = "$ISMASMGR_INI" ]; then
if grep -qE "$ISMASMGR_SYS_DIR" <<< "${f%/*}"; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f}"
__m="$__m $ISMASMGR_SYS_DIR/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $ISMASMGR_SYS_DIR/${__f}
__copy_error=$?
__p="$ISMASMGR_SYS_DIR/${__f}"
elif grep -qE "$ATB_SYS_DIR" <<< "${f%/*}"; then
__p="$ATB_SYS_DIR/${__f}"
else
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f}"
__m="$__m $SYSCONFIG_SYS_DIR/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" $SYSCONFIG_SYS_DIR/${__f}
__copy_error=$?
__p="$SYSCONFIG_SYS_DIR/${__f}"
fi
fi
fi
if [ $__copy_error -ne 0 ]; then
log_error "$func:${LINENO}: $__m failed"
update_psa_copy_conf_and_ini_files \
$UPDATE_ISMAS_ERROR $RC_COPY_ERROR "$__m failed"
return $?
if [ ! -z "$__p" ]; then
if cp "$__m" "$__p"; then
log_info "$func:${LINENO}: cp $__m $__p ok"
update_psa_copy_conf_and_ini_files $UPDATE_ISMAS_PROGRESS \
$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_info "$func:${LINENO}: $__m ok"
update_psa_copy_conf_and_ini_files $UPDATE_ISMAS_PROGRESS \
$RC_SUCCESS "$__m ok"
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
done
@ -106,6 +115,7 @@ copy () {
else
log_debug "$func:${LINENO}: copied *conf/*ini-files to system-dirs"
fi
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"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
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
js_key=".ini.$__cl.zg[1].z[1].opt.app.ATBAPP.ATBQT"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)
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
js_key=".ini.$__cl.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_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
js_key=".ini.$__cl.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_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
js_key=".ini.$__cl.zg[1].z[1].opt.app.ISMASMgr.ISMASMgr"
md5sum_update_conf=$(cat $UPDATE_CONF | jq -r $js_key)