Compare commits

..

4 Commits

3 changed files with 23 additions and 72 deletions

View File

@ -145,14 +145,14 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
# Zone aus /etc/zone_nr auslesen # Zone aus /etc/zone_nr auslesen
# #
readonly ZONE_GROUP=1 readonly ZONE_GROUP=1
readonly ZONE=1 readonly ZONE=2
readonly CUST_BASE_DIR="${CUST_BASE_DIRS[$ZONE]}" readonly CUST_BASE_DIR="${CUST_BASE_DIRS[$ZONE]}"
assert_d CUST_BASE_DIR assert_d CUST_BASE_DIR
readonly ETC_SYS_DIR="/etc" readonly ETC_SYS_DIR="/etc"
readonly ATB_SYS_DIR="/etc/atb" readonly ATB_SYS_DIR="/etc/atb"
readonly DC_SYS_DIR="/etc/dc" readonly DC_SYS_DIR="/etc/dc"
readonly TARIFF_SYS_DIR="/etc/tariff" readonly TARIFF_SYS_DIR="/etc/psa_tariff"
readonly OPKG_SYS_DIR="/etc/psa_update" readonly OPKG_SYS_DIR="/etc/psa_update"
readonly CONF_SYS_DIR="/etc/psa_config" readonly CONF_SYS_DIR="/etc/psa_config"
readonly OPT_SYS_DIR="/opt" readonly OPT_SYS_DIR="/opt"
@ -180,6 +180,8 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly SYSCTRL_INI="SystemControl.ini" readonly SYSCTRL_INI="SystemControl.ini"
readonly TARIFF_CURRENT="tariff.current" readonly TARIFF_CURRENT="tariff.current"
readonly DC="dc2c.hex" readonly DC="dc2c.hex"
readonly TARIFF_SUMMER="summer_tariff.json"
readonly TARIFF_WINTER="winter_tariff.json"
readonly DC_SYS_DC_FILE="${DC_SYS_DIR}/$DC" readonly DC_SYS_DC_FILE="${DC_SYS_DIR}/$DC"
readonly ATBQT_ATB_SYS_BIN_FILE="${ATBAPP_SYS_DIR}/$ATBQT_BIN" readonly ATBQT_ATB_SYS_BIN_FILE="${ATBAPP_SYS_DIR}/$ATBQT_BIN"
@ -204,6 +206,8 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly DC2C_SYS_CASH_JSON="${CONF_SYS_DIR}/DC2C_cash.json" readonly DC2C_SYS_CASH_JSON="${CONF_SYS_DIR}/DC2C_cash.json"
readonly DC2C_SYS_CONF_JSON="${CONF_SYS_DIR}/DC2C_conf.json" readonly DC2C_SYS_CONF_JSON="${CONF_SYS_DIR}/DC2C_conf.json"
readonly DC_PSA_DC_FILE="${DC_PSA_DIR}/$DC" readonly DC_PSA_DC_FILE="${DC_PSA_DIR}/$DC"
readonly TARIFF_SYS_SUMMER="${TARIFF_SYS_DIR}${TARIFF_SUMMER}"
readonly TARIFF_SYS_WINTER="${TARIFF_SYS_DIR}${TARIFF_WINTER}"
readonly ATBQT_ATB_PSA_INI_FILE="${ATB_PSA_DIR}/$ATBQT_INI" readonly ATBQT_ATB_PSA_INI_FILE="${ATB_PSA_DIR}/$ATBQT_INI"
readonly ATBQT_APP_PSA_INI_FILE="${ATBAPP_PSA_DIR}/$ATBQT_INI" readonly ATBQT_APP_PSA_INI_FILE="${ATBAPP_PSA_DIR}/$ATBQT_INI"
@ -319,17 +323,26 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
for i in {1..32}; do # up to 32 print-json-files for i in {1..32}; do # up to 32 print-json-files
local __f=${CONF_PSA_DIR}/DC2C_print$(printf "%02d" $i).json local __f=${CONF_PSA_DIR}/DC2C_print$(printf "%02d" $i).json
readonly DC2C_PRINT$(printf "%02d" $i)_JSON=$__f readonly DC2C_PRINT$(printf "%02d" $i)_JSON=$__f
# local __g=$(eval echo '$'DC2C_PRINT$(printf "%02d" $i)_JSON)
assert_f DC2C_PRINT$(printf "%02d" $i)_JSON assert_f DC2C_PRINT$(printf "%02d" $i)_JSON
DC2C_PRINT_JSON+=($__f) DC2C_PRINT_JSON+=($__f)
done done
local TARIFF_FILES_JSON=()
for i in {1..32}; do # up to 32 tariff-json-files
local __f=${TARIFF_PSA_DIR}/tariff$(printf "%02d" $i).json
readonly TARIFF$(printf "%02d" $i)_JSON=$__f
assert_f TARIFF$(printf "%02d" $i)_JSON
TARIFF_FILES_JSON+=($__f)
done
readonly KNOWN_CONF_FILES=(${CUSTOMER_LOCATION}/update.conf \ readonly KNOWN_CONF_FILES=(${CUSTOMER_LOCATION}/update.conf \
${DC2C_PRINT_JSON[@]##*${CUSTOMER_ID}/} \ ${DC2C_PRINT_JSON[@]##*${CUSTOMER_ID}/} \
${DC2C_PSA_CONF_JSON##*${CUSTOMER_ID}/} \ ${DC2C_PSA_CONF_JSON##*${CUSTOMER_ID}/} \
${DC2C_PSA_CASH_JSON##*${CUSTOMER_ID}/} \ ${DC2C_PSA_CASH_JSON##*${CUSTOMER_ID}/} \
${DC2C_PSA_SERIAL_JSON##*${CUSTOMER_ID}/}) ${DC2C_PSA_SERIAL_JSON##*${CUSTOMER_ID}/})
readonly KNOWN_TARIFF_FILES=(${TARIFF_FILES_JSON[@]##*${CUSTOMER_ID}/})
readonly KNOWN_INI_FILES=(${ATBAPP_PSA_INI_FILE##*${CUSTOMER_ID}/} \ readonly KNOWN_INI_FILES=(${ATBAPP_PSA_INI_FILE##*${CUSTOMER_ID}/} \
${ISMASMGRATB_PSA_INI_FILE##*${CUSTOMER_ID}/} \ ${ISMASMGRATB_PSA_INI_FILE##*${CUSTOMER_ID}/} \
${ISMASMGRAPP_PSA_INI_FILE##*${CUSTOMER_ID}/} \ ${ISMASMGRAPP_PSA_INI_FILE##*${CUSTOMER_ID}/} \
@ -347,6 +360,7 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly KNOWN_FILES=(${KNOWN_CONF_FILES[@]} \ readonly KNOWN_FILES=(${KNOWN_CONF_FILES[@]} \
${KNOWN_INI_FILES[@]} \ ${KNOWN_INI_FILES[@]} \
${KNOWN_TARIFF_FILES[@]} \
${DC_PSA_DC_FILE##*${CUSTOMER_ID}/} \ ${DC_PSA_DC_FILE##*${CUSTOMER_ID}/} \
${OPKG_CMDS_PSA_FILE##*${CUSTOMER_ID}/}) ${OPKG_CMDS_PSA_FILE##*${CUSTOMER_ID}/})

View File

@ -46,6 +46,8 @@ copy () {
# local sysdir=$(echo $f | # local sysdir=$(echo $f |
# sed -E -e s'=(.*szeged/[0-9]/[0-9])(.*)(/.*)=\2=g') # sed -E -e s'=(.*szeged/[0-9]/[0-9])(.*)(/.*)=\2=g')
# TODO: kuerzen
copy_necessary=1 copy_necessary=1
PERCENT=$((PERCENT+1)) PERCENT=$((PERCENT+1))
@ -60,6 +62,8 @@ copy () {
if grep -qE "^.*$DC\s*$" <<< ${f}; then if grep -qE "^.*$DC\s*$" <<< ${f}; then
__p="${DC_SYS_DIR}/${__f}" __p="${DC_SYS_DIR}/${__f}"
log_debug "$func:${LINENO}: __m=$__m" log_debug "$func:${LINENO}: __m=$__m"
elif grep -qE "^.*tariff[0-9][0-9][.]json\s*$" <<< ${f}; then
__p="${TARIFF_SYS_DIR}/${__f}"
elif grep -qE "^.*[.]json\s*$" <<< ${f}; then elif grep -qE "^.*[.]json\s*$" <<< ${f}; then
__p="${CONF_SYS_DIR}/${__f}" __p="${CONF_SYS_DIR}/${__f}"
log_debug "$func:${LINENO}: __m=$__m" log_debug "$func:${LINENO}: __m=$__m"
@ -167,89 +171,22 @@ check_md5_for_changed_json_and_ini_files () {
# .../szeged/1/1... # .../szeged/1/1...
log_debug "$func:${LINENO} checking file=${file}..." log_debug "$func:${LINENO} checking file=${file}..."
local __fs=${file##*.} 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="" js_key=""
case $file in case $file in
*.ini | *.json | *.hex) *.ini | *.json | *.hex)
set -x
local __key_suffix=$(echo $file | local __key_suffix=$(echo $file |
sed -E -e 's=(.*[0-9]/[0-9])([^.]+)(.*)=\2=g' -e 's=/=.=g') sed -E -e 's=(.*[0-9]/[0-9])([^.]+)(.*)=\2=g' -e 's=/=.=g')
js_key=".$__fs.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix" js_key=".$__fs.$__cl.zg[$ZONE_GROUP].z[$ZONE]$__key_suffix"
md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key) md5sum_update_conf=$(cat $PSA_UPDATE_CONF | jq -r $js_key)
md5sum_repository="$(md5_of $CUSTOMER_ID_BASE_DIR/$file)" 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}" log_crit "$func:${LINENO} unknown file=${file}"
;; ;;
esac 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 test -z $js_key && continue
PERCENT=$((PERCENT+1)) PERCENT=$((PERCENT+1))

View File

@ -17,7 +17,7 @@ collect_current_configuration () {
current_settings_to_ismas current_settings_to_ismas
#for line in $(cat $PSA_UPDATE_CONF |\ #for line in $(cat $PSA_UPDATE_CONF |\
# jq -r .conf.szeged.zg[1].z[1].etc.psa_config) # jq -r .conf.szeged.zg[$ZONE_GROUP].z[$ZONE].etc.psa_config)
#do #do
# conf_file="$(echo $line | # conf_file="$(echo $line |
# sed -E -ne 's/^[^{}]\s+\"(DC2C_[[:alnum:]]+)\".*$/\1/gp')" # sed -E -ne 's/^[^{}]\s+\"(DC2C_[[:alnum:]]+)\".*$/\1/gp')"