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

View File

@ -179,6 +179,14 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
else
log_fatal "$func:${LINENO}: $psa_update_dir does not exist"
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"
if [ -d "$psa_base_ini_dir" ]; then
@ -266,6 +274,14 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
"does not exist"
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 __sysc_sysc_full="${PSA_SYSCONFIG_DIR}/$SYS_CONFIG_INI"
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}: "\
"$SYSCONFIG_SYSCONFIG_INI_FULL does not exist"
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"
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
log_fatal "$func:${LINENO}: $SYSCONFIG_SYSCTRL_INI_FULL does not exist"
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"
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}/} \
${SYSCONFIG_ISMASMGR_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[@]} \
${KNOWN_INI_FILES[@]} \

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)