Added handling for DC

This commit is contained in:
Gerhard Hoffmann 2022-06-02 21:52:48 +02:00
parent 312f87487d
commit 1ad3b7e68f

View File

@ -51,7 +51,11 @@ copy () {
local __m="" local __m=""
local __copy_error=0 local __copy_error=0
if grep -qE "^.*[.]json\s*$" <<< ${f}; then 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=$?
elif grep -qE "^.*[.]json\s*$" <<< ${f}; then
__m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${CONF_SYS_DIR}/${__f}" __m="cp ${CUSTOMER_ID_BASE_DIR}/${f} to ${CONF_SYS_DIR}/${__f}"
cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${CONF_SYS_DIR}/${__f}" cp "${CUSTOMER_ID_BASE_DIR}/${f}" "${CONF_SYS_DIR}/${__f}"
__copy_error=$? __copy_error=$?
@ -105,14 +109,14 @@ copy () {
return 0 return 0
} }
filter_json_ini_files () { filter_changed_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"
local __system_files="" local __system_files=""
for f in ${files[@]}; do for f in ${files[@]}; do
log_debug "$func:${LINENO} $f" log_debug "$func:${LINENO} $f"
if grep -qE "^.*[.](json|ini)\s*$" <<< $f; then if grep -qE "^.*[.]($2)\s*$" <<< $f; then
if [ -z $__system_files ]; then if [ -z $__system_files ]; then
__system_files="${f}" __system_files="${f}"
else else
@ -142,47 +146,49 @@ check_md5_for_changed_json_and_ini_files () {
log_debug "$func:${LINENO} files=$1" log_debug "$func:${LINENO} files=$1"
if ! [ -z $1 ]; then if ! [ -z $1 ]; then
readarray -td' ' files <<< "$1" readarray -td' ' files <<< "$1"
local readonly __cl=$CUSTOMER_LOCATION
for file in ${files[@]}; do for file in ${files[@]}; do
log_debug "$func:${LINENO} checking file=${file}..." log_debug "$func:${LINENO} checking file=${file}..."
local __fsuffix=${file##*.} local __fsuffix=${file##*.}
local __bn=$(basename $file .$__fsuffix) local __bn=$(basename $file .$__fsuffix)
if [[ "$file" =~ .*cash[.]json.* ]]; then if [[ "$file" =~ .*dc2c.hex.* ]]; then
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.$__bn" js_key=".dc.dc2c.$__bn"
md5sum_update_conf=$(cat $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 $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" =~ .*print[0-9][0-9][.]json.* ]]; then elif [[ "$file" =~ .*print[0-9][0-9][.]json.* ]]; then
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.$__bn" js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.$__bn"
echo "$js_key"
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" =~ .*conf[.]json.* ]]; then elif [[ "$file" =~ .*conf[.]json.* ]]; then
js_key=".conf.szeged.zg[1].z[1].etc.psa_config.DC2C_conf" js_key=".conf.$__cl.zg[1].z[1].etc.psa_config.DC2C_conf"
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" =~ .*serial[.]json.* ]]; then elif [[ "$file" =~ .*serial[.]json.* ]]; then
js_key=".conf.szeged.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" =~ .*ATBQT[.]ini.* ]]; then elif [[ "$file" =~ .*ATBQT[.]ini.* ]]; then
js_key=".ini.szeged.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" =~ .*sysconfig[.]ini.* ]]; then elif [[ "$file" =~ .*sysconfig[.]ini.* ]]; then
js_key=".ini.szeged.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" =~ .*SystemControl[.]ini.* ]]; then elif [[ "$file" =~ .*SystemControl[.]ini.* ]]; then
js_key=".ini.szeged.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" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then elif [[ "$file" =~ .*ISMASMgr/ISMASMgr[.]ini.* ]]; then
js_key=".ini.szeged.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)
md5sum_repository=$(md5_of $ISMASMGR_ISMASMGR_INI_FULL) md5sum_repository=$(md5_of $ISMASMGR_ISMASMGR_INI_FULL)
elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then elif [[ "$file" =~ .*sysconfig/ISMASMgr[.]ini.* ]]; then
js_key=".ini.szeged.zg[1].z[1].opt.app.sysconfig.ISMASMgr" js_key=".ini.$__cl.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_FULL) md5sum_repository=$(md5_of $SYSCONFIG_ISMASMGR_INI_FULL)
else else
@ -366,3 +372,22 @@ check_for_apism () {
nc localhost 7778 nc localhost 7778
} }
get_plugins () {
local __plugins=""
for __f in /opt/app/ATBAPP/plugins/*; do
local plugin=$__f
plugins+="
\"${plugin##*/}\": {
"
plugins+=$(strings $__f |
grep -A4 \"Interface\": |
grep \"Version\" |
sed -E -e 's/^\s*/\n/g')
# remove trailing ',' which is already contained in returned value
plugins=${plugins/%,}
plugins+="
},"
done
printf '%s' ${plugins/%,}
}
# get_plugins