Compare commits

...

4 Commits

3 changed files with 124 additions and 39 deletions

View File

@ -51,6 +51,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -93,6 +94,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -108,6 +110,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -138,6 +141,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -172,6 +176,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -191,6 +196,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -211,6 +217,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -241,6 +248,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -260,6 +268,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -279,6 +288,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -298,6 +308,7 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
EXITCODE=$((EXITCODE+1)) EXITCODE=$((EXITCODE+1))
test $EXITCODE -gt 125 && EXITCODE=125 test $EXITCODE -gt 125 && EXITCODE=125
log_debug "${FUNCNAME[0]}:${LINENO}: EXITCODE=$EXITCODE"
return $EXITCODE return $EXITCODE
} }
@ -366,6 +377,9 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
local p=("$@") local p=("$@")
local data="#M=APISM#C=CMD_SENDVERSION#J= local data="#M=APISM#C=CMD_SENDVERSION#J=
{ {
\"VERSION_INFO\" : {
\"CREATED\":\"$(date +%Y-%m-%dT%T)\"
},
\"TARIFF\": { \"TARIFF\": {
$(<$TARIFF_CURRENT_FULL) $(<$TARIFF_CURRENT_FULL)
}, },
@ -408,10 +422,11 @@ if [ ${news_to_ismas_sourced:-1} = "1" ]; then # include only once
} }
} }
}" }"
log_debug "$func:${LINENO}: data=$data"
log_debug "$func:${LINENO}: data=$data EXITCODE=$EXITCODE"
echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT) echo $((echo "$data"; sleep 1) | nc localhost $APISM_DB_PORT)
# if [ $EXITCODE -eq $RC_SUCCESS ]; then # if [ $EXITCODE -eq $RC_SUCCESS ]; then
update_psa_update_succeeded $UPDATE_SUCCEEDED \ update_psa_update_succeeded $UPDATE_SUCCEEDED \
$RC_SUCCESS "psa update succeeded" $RC_SUCCESS "psa update succeeded"

View File

@ -179,6 +179,14 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
else else
log_fatal "$func:${LINENO}: $psa_update_dir does not exist" log_fatal "$func:${LINENO}: $psa_update_dir does not exist"
fi fi
readonly ATB_SYS_DIR="/etc/atb"
readonly PSA_ATB_SYS_DIR="${CUSTOMER_BASE_DIR}${ATB_SYS_DIR}"
if [ -d "$PSA_ATB_SYS_DIR" ]; then
log_debug "$func:${LINENO}: PSA_ATB_SYS_DIR=$PSA_ATB_SYS_DIR"
else
log_fatal "$func:${LINENO}: $PSA_ATB_SYS_DIR does not exist"
fi
readonly psa_base_ini_dir="${CUSTOMER_BASE_DIR}/opt/app" readonly psa_base_ini_dir="${CUSTOMER_BASE_DIR}/opt/app"
if [ -d "$psa_base_ini_dir" ]; then if [ -d "$psa_base_ini_dir" ]; then
@ -266,6 +274,14 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
"does not exist" "does not exist"
fi fi
readonly ATB_ISMASMGR_INI_FULL="${PSA_ATB_SYS_DIR}/$ISMASMGR_INI"
if [ -f "$ATB_ISMASMGR_INI_FULL" ]; then
log_debug "$func:${LINENO}: atb_ismasmgr.ini="
log_debug "$func:${LINENO}: $ATB_ISMASMGR_INI_FULL"
else
log_fatal "$func:${LINENO}: $ATB_ISMASMGR_INI_FULL does not exist"
fi
readonly SYS_CONFIG_INI="sysconfig.ini" readonly SYS_CONFIG_INI="sysconfig.ini"
readonly __sysc_sysc_full="${PSA_SYSCONFIG_DIR}/$SYS_CONFIG_INI" readonly __sysc_sysc_full="${PSA_SYSCONFIG_DIR}/$SYS_CONFIG_INI"
readonly SYSCONFIG_SYSCONFIG_INI_FULL="$__sysc_sysc_full" readonly SYSCONFIG_SYSCONFIG_INI_FULL="$__sysc_sysc_full"
@ -276,6 +292,14 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
log_fatal "$func:${LINENO}: "\ log_fatal "$func:${LINENO}: "\
"$SYSCONFIG_SYSCONFIG_INI_FULL does not exist" "$SYSCONFIG_SYSCONFIG_INI_FULL does not exist"
fi fi
readonly ATB_SYSCONFIG_INI_FULL="${PSA_ATB_SYS_DIR}/$SYS_CONFIG_INI"
if [ -f "$ATB_SYSCONFIG_INI_FULL" ]; then
log_debug "$func:${LINENO}: atb_sysconfig.ini="
log_debug "$func:${LINENO}: $ATB_SYSCONFIG_INI_FULL"
else
log_fatal "$func:${LINENO}: $ATB_SYSCONFIG_INI_FULL does not exist"
fi
readonly "SYSTEM_CONTROL_INI"="SystemControl.ini" readonly "SYSTEM_CONTROL_INI"="SystemControl.ini"
local __sysctrl_ini_full="${PSA_SYSCONFIG_DIR}/$SYSTEM_CONTROL_INI" local __sysctrl_ini_full="${PSA_SYSCONFIG_DIR}/$SYSTEM_CONTROL_INI"
@ -286,6 +310,22 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
else else
log_fatal "$func:${LINENO}: $SYSCONFIG_SYSCTRL_INI_FULL does not exist" log_fatal "$func:${LINENO}: $SYSCONFIG_SYSCTRL_INI_FULL does not exist"
fi fi
readonly ATB_SYSCTRL_INI_FULL="${PSA_ATB_SYS_DIR}/$SYSTEM_CONTROL_INI"
if [ -f "$ATB_SYSCTRL_INI_FULL" ]; then
log_debug "$func:${LINENO}: atb_systemcontrol.ini="
log_debug "$func:${LINENO}: $ATB_SYSCTRL_INI_FULL"
else
log_fatal "$func:${LINENO}: $ATB_SYSCTRL_INI_FULL does not exist"
fi
readonly ATB_ATBQT_INI_FULL="${PSA_ATB_SYS_DIR}/$ATBQT_INI"
if [ -f "$ATB_ATBQT_INI_FULL" ]; then
log_debug "$func:${LINENO}: ATBQT.ini="
log_debug "$func:${LINENO}: $ATB_ATBQT_INI_FULL"
else
log_fatal "$func:${LINENO}: $ATB_ATBQT_INI_FULL does not exist"
fi
readonly DC2C_SERIAL_JSON="${psa_config_dir}/DC2C_serial.json" readonly DC2C_SERIAL_JSON="${psa_config_dir}/DC2C_serial.json"
if [ -f "$DC2C_SERIAL_JSON" ]; then if [ -f "$DC2C_SERIAL_JSON" ]; then
@ -344,7 +384,11 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
${ISMASMGR_ISMASMGR_INI_FULL##*${CUSTOMER_ID}/} \ ${ISMASMGR_ISMASMGR_INI_FULL##*${CUSTOMER_ID}/} \
${SYSCONFIG_ISMASMGR_INI_FULL##*${CUSTOMER_ID}/} \ ${SYSCONFIG_ISMASMGR_INI_FULL##*${CUSTOMER_ID}/} \
${SYSCONFIG_SYSCONFIG_INI_FULL##*${CUSTOMER_ID}/} \ ${SYSCONFIG_SYSCONFIG_INI_FULL##*${CUSTOMER_ID}/} \
${SYSCONFIG_SYSCTRL_INI_FULL##*${CUSTOMER_ID}/}) ${SYSCONFIG_SYSCTRL_INI_FULL##*${CUSTOMER_ID}/} \
${ATB_ISMASMGR_INI_FULL##*${CUSTOMER_ID}/} \
${ATB_SYSCONFIG_INI_FULL##*${CUSTOMER_ID}/} \
${ATB_SYSCTRL_INI_FULL##*${CUSTOMER_ID}/} \
${ATB_ATBQT_INI_FULL##*${CUSTOMER_ID}/})
readonly KNOWN_FILES=(${KNOWN_CONF_FILES[@]} \ readonly KNOWN_FILES=(${KNOWN_CONF_FILES[@]} \
${KNOWN_INI_FILES[@]} \ ${KNOWN_INI_FILES[@]} \

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" update_psa_copy_conf_and_ini_files $UPDATE_ISMAS_PROGRESS \
return $? $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 else
log_info "$func:${LINENO}: $__m ok" log_error "$func:${LINENO}: __p still empty"
update_psa_copy_conf_and_ini_files $UPDATE_ISMAS_PROGRESS \ update_psa_copy_conf_and_ini_files \
$RC_SUCCESS "$__m ok" $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)