shortened check_md5sum....()

This commit is contained in:
Gerhard Hoffmann 2022-06-02 22:11:12 +02:00
parent c3def117a5
commit e46f596270

View File

@ -41,6 +41,10 @@ copy () {
if [[ "$f" =~ .*update[.]conf.* ]]; then
continue
fi
# macht fuer dc keinen sinn
# local sysdir=$(echo $f |
# sed -E -e s'=(.*szeged/[0-9]/[0-9])(.*)(/.*)=\2=g')
copy_necessary=1
@ -50,12 +54,14 @@ copy () {
local readonly __f=${f##*/}
local readonly __m="${CUSTOMER_ID_BASE_DIR}/${f}"
local __p=""
# echo "TEST -> $sysdir/$__f"
if grep -qE "^.*$DC\s*$" <<< ${f}; then
__p=" ${DC_SYS_DIR}/${__f}"
__p="${DC_SYS_DIR}/${__f}"
log_debug "$func:${LINENO}: __m=$__m"
elif grep -qE "^.*[.]json\s*$" <<< ${f}; then
__p=" ${CONF_SYS_DIR}/${__f}"
__p="${CONF_SYS_DIR}/${__f}"
log_debug "$func:${LINENO}: __m=$__m"
elif grep -qE "^.*[.]ini\s*$" <<< ${f}; then
if [ "$__f" = "$ATBQT_INI" ]; then
@ -158,72 +164,93 @@ check_md5_for_changed_json_and_ini_files () {
readarray -td' ' files <<< "$1"
local readonly __cl=$CUSTOMER_LOCATION
for file in ${files[@]}; do
# .../szeged/1/1...
log_debug "$func:${LINENO} checking file=${file}..."
local __fsuffix=${file##*.}
local __bn=$(basename $file .$__fsuffix)
if [[ "$file" =~ .*dc2c.hex.* ]]; then
js_key=".dc.dc2c.$__bn"
md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
elif [[ "$file" =~ .*cash[.]json.* ]]; then
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.$__bn"
md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
elif [[ "$file" =~ .*print[0-9][0-9][.]json.* ]]; then
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.$__bn"
md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
elif [[ "$file" =~ .*conf[.]json.* ]]; then
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.DC2C_conf"
md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
elif [[ "$file" =~ .*serial[.]json.* ]]; then
js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.DC2C_serial"
md5sum_update_conf=$(cat $PSA_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 $PSA_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 $PSA_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 $PSA_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 $PSA_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 $PSA_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 $PSA_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 $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $ATB_ISMASMGR_INI_FULL)"
elif [[ "$file" =~ .*etc/ISMASMgr[.]ini.* ]]; then
js_key=".ini.$__cl.zg[1].z[1].etc.ISMASMgr"
md5sum_update_conf=$(cat $PSA_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 $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository=$(md5_of $ISMASMGR_ISMASMGR_INI_FULL)
elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then
js_key=".ini.$__cl.zg[1].z[1].opt.app.sysconfig.ISMASMgr"
md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository=$(md5_of $SYSCONFIG_ISMASMGR_INI_FULL)
else
continue
fi
local __fs=${file##*.}
# local __bn=$(basename $file .$__fsuffix)
# local __key_suffix=$(echo $file |
# sed -E -e 's=(.*[0-9]/[0-9])([^.]+)(.*)=\2=g' -e 's=/=.=g')
js_key=""
case $file in
*.ini | *.json | *.hex)
set -x
local __key_suffix=$(echo $file |
sed -E -e 's=(.*[0-9]/[0-9])([^.]+)(.*)=\2=g' -e 's=/=.=g')
js_key=".$__fs.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
set +x
;;
# *.hex)
# js_key=$(echo $file |
# sed -E -e 's=(.*szeged)([^.]+)(.*)=\2=g' -e 's=/=.=g')
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
# ;;
*)
log_crit "$func:${LINENO} unknown file=${file}"
;;
esac
#if [[ "$file" =~ .*dc2c.hex.* ]]; then
# js_key=$(echo $file |
# sed -E -e 's=(.*$CUSTOMER_LOCATION)([^.]+)(.*)=\2=g'
# -e 's=/=.=g')
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
#else
# if [[ "$file" =~ .*cash[.]json.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
# elif [[ "$file" =~ .*print[0-9][0-9][.]json.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
# elif [[ "$file" =~ .*conf[.]json.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
# elif [[ "$file" =~ .*serial[.]json.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)"
####################################################################
## ATBQT.ini
####################################################################
# elif [[ "$file" =~ .*/$ATBQT_INI.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository=$(md5_of $CUSTOMER_ID_BASE_DIR/$file)
####################################################################
## sysconfig.ini
####################################################################
# elif [[ "$file" =~ .*/$SYSCONF_INI.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository=$(md5_of $CUSTOMER_ID_BASE_DIR/$file)
####################################################################
## SystemControl.ini
####################################################################
# elif [[ "$file" =~ .*/$SYSCTRL_INI.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository=$(md5_of $CUSTOMER_ID_BASE_DIR/$file)
####################################################################
## ISMASMgr.ini
####################################################################
# elif [[ "$file" =~ .*/$ISMASMMGR_INI.* ]]; then
# js_key=".ini.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
# md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
# md5sum_repository=$(md5_of $CUSTOMER_ID_BASE_DIR/$file)
# fi
#fi
test -z $js_key && continue
PERCENT=$((PERCENT+1))
test $PERCENT -gt 100 && PERCENT=100