2022-06-06 18:53:30 +02:00
|
|
|
#! /bin/bash -
|
2022-06-03 20:49:33 +02:00
|
|
|
# set -x
|
|
|
|
|
2022-06-04 18:14:16 +02:00
|
|
|
source ./log_helpers
|
2022-06-05 21:42:53 +02:00
|
|
|
source ./general_utils
|
2022-06-03 20:49:33 +02:00
|
|
|
|
2022-06-04 18:14:16 +02:00
|
|
|
if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
|
|
|
readonly read_config_sourced=${BASH_SOURCE[0]}
|
2022-06-02 16:03:24 +02:00
|
|
|
|
|
|
|
readonly MAJOR="0"
|
|
|
|
readonly MINOR="1"
|
|
|
|
readonly PATCH="0"
|
2022-06-03 20:49:33 +02:00
|
|
|
|
2022-06-03 21:47:55 +02:00
|
|
|
readonly DATEFLAGS="+%Y.%m.%dT%H.%M.%S"
|
2022-06-06 18:53:30 +02:00
|
|
|
readonly STRIPCOMMENTS='sed -e s/#.*$//g'
|
|
|
|
readonly STRIPWHITESPACE='sed -E -e s/^[[:space:]]*$//g'
|
2022-06-03 21:47:55 +02:00
|
|
|
readonly INDENT="awk '{ print \"\t\t\t\" \$0 }'"
|
|
|
|
readonly JOINLINES="tr '\n' '\040'"
|
|
|
|
|
|
|
|
readonly UPDATEPSAHOME=$HOME/.updatepsa
|
|
|
|
|
|
|
|
readonly UPDATEPSABEGIN=./.updatepsa/begin
|
|
|
|
readonly UPDATEPSAEND=./.updatepsa/end
|
|
|
|
|
2023-05-24 13:06:25 +02:00
|
|
|
# name of file containing the logs following a 'git pull':
|
|
|
|
# basically, there are two kinds of entries:
|
|
|
|
readonly GIT_UPDATE_LOG=/opt/app/tools/atbupdate/update_log.csv
|
2022-06-07 22:32:46 +02:00
|
|
|
|
2022-06-03 21:47:55 +02:00
|
|
|
readonly PROGRAM=`basename $0`
|
|
|
|
readonly WORKSPACE_DIR=workspace
|
|
|
|
|
2022-06-02 21:52:10 +02:00
|
|
|
EXITCODE=$RC_SUCCESS
|
2023-05-26 15:05:25 +02:00
|
|
|
INITIAL_CLONE=false
|
2022-06-25 15:07:23 +02:00
|
|
|
APISM_RUNNING=0
|
|
|
|
|
2022-06-04 18:14:16 +02:00
|
|
|
# read config file (JSON syntax)
|
|
|
|
read_config() {
|
|
|
|
local func="${FUNCNAME[0]}"
|
2022-06-03 21:47:55 +02:00
|
|
|
|
2022-06-06 20:07:47 +02:00
|
|
|
CONFIGFILENAME=${CONFIGFILENAME:-'update_psa.conf'}
|
|
|
|
|
|
|
|
if ! [ -f "$CONFIGFILENAME" ]; then
|
|
|
|
log_fatal "$func:${LINENO}: $CONFIGFILENAME not found"
|
|
|
|
fi
|
|
|
|
|
2022-06-03 21:47:55 +02:00
|
|
|
log_debug "$func:${LINENO}: CONFIGFILENAME=$CONFIGFILENAME"
|
|
|
|
log_debug "$func:${LINENO}: WORKING_DIRECTORY=$WORKING_DIRECTORY"
|
2022-06-04 18:14:16 +02:00
|
|
|
|
2022-06-03 21:47:55 +02:00
|
|
|
local readonly cf="$CONFIGFILENAME"
|
|
|
|
|
|
|
|
readonly GIT_SSL_NO_VERIFY="$(cat "$cf" | jq -r .GIT_SSL_NO_VERIFY)"
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_s GIT_SSL_NO_VERIFY
|
|
|
|
|
2022-06-03 21:47:55 +02:00
|
|
|
readonly CUSTOMER_LOCATION=$(cat "$cf" | jq -r .customer_location)
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_s CUSTOMER_LOCATION
|
2022-06-05 21:54:08 +02:00
|
|
|
|
2022-06-05 21:42:53 +02:00
|
|
|
readonly CUSTOMER_ID="$(cat "$cf" | jq -r .customer_id)"
|
|
|
|
assert_s CUSTOMER_ID
|
2022-06-04 18:14:16 +02:00
|
|
|
|
2022-06-05 21:42:53 +02:00
|
|
|
readonly CUSTOMER_REPOSITORY_PATH="$(cat "$cf" |
|
|
|
|
jq -r .cust_repository_path)"
|
|
|
|
assert_s CUSTOMER_REPOSITORY_PATH
|
2022-06-06 20:07:47 +02:00
|
|
|
|
|
|
|
local __customer_id_base_dir="$WORKING_DIRECTORY/${WORKSPACE_DIR}"
|
|
|
|
readonly CUSTOMER_ID_BASE_DIR="${__customer_id_base_dir}/${CUSTOMER_ID}"
|
2022-06-05 21:54:08 +02:00
|
|
|
|
2022-06-06 18:53:30 +02:00
|
|
|
local __number_of_zone_groups=$(cat "$cf" |
|
|
|
|
jq -r .zg[0] |
|
|
|
|
sed -E -e 's/[[:space:]]*//g')
|
|
|
|
# TODO: was ist hier falsch
|
|
|
|
# __n_of_zgroups=$(echo "$__n_of_zgrps" | ${STRIPWHITESPACE} )
|
2022-06-06 20:13:04 +02:00
|
|
|
# log_debug "$func:${LINENO}: #n of zone_groups: $__number_of_zone_groups"
|
2022-06-06 18:53:30 +02:00
|
|
|
|
|
|
|
local __zone_groups=($__number_of_zone_groups)
|
|
|
|
for zg in `seq 1 $__number_of_zone_groups`; do
|
|
|
|
local __n_zones=$(cat "$cf" |
|
|
|
|
jq -r .zg[$zg].z |
|
|
|
|
sed -E -e 's/[][,[:space:]]*//g') # rm ][ as well
|
2022-06-05 21:54:08 +02:00
|
|
|
__zone_groups[$zg]=$__n_zones
|
|
|
|
done
|
|
|
|
|
2022-06-06 18:53:30 +02:00
|
|
|
readonly ZONE_GROUPS=(${__zone_groups[@]})
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_a ZONE_GROUPS
|
2022-06-12 13:10:48 +02:00
|
|
|
|
|
|
|
# TODO
|
|
|
|
# TODO: falls mehrere gruppen/zonen auftauchen hier anpassen
|
|
|
|
# TODO
|
|
|
|
# Zone aus /etc/zone_nr auslesen
|
|
|
|
#
|
|
|
|
readonly ZONE_GROUP=1
|
2023-05-26 15:05:25 +02:00
|
|
|
local __zone=1
|
|
|
|
readonly ZONE_FILE="$(cat "$cf" | jq -r .zone)"
|
|
|
|
if [ -f "$ZONE_FILE" ]; then
|
|
|
|
__zone=$(cat "$ZONE_FILE")
|
|
|
|
__zone=$((__zone))
|
|
|
|
fi
|
|
|
|
|
|
|
|
readonly ZONE=$__zone
|
2022-06-12 13:10:48 +02:00
|
|
|
readonly LOCAL_BRANCH="$(cat "$cf" | jq -r .local_branches[$ZONE])"
|
2022-06-06 18:53:30 +02:00
|
|
|
|
2023-05-26 15:05:25 +02:00
|
|
|
if [ -z "$WORKING_DIRECTORY" ]; then
|
|
|
|
log_fatal "${func}:${LINENO}: empty WORKING_DIRECTORY"
|
|
|
|
fi
|
|
|
|
if ! cd "$WORKING_DIRECTORY"; then
|
|
|
|
log_fatal "${func}:${LINENO}: cannot cd to $WORKING_DIRECTORY"
|
|
|
|
fi
|
|
|
|
log_debug "${func}:${LINENO}: cd to $WORKING_DIRECTORY"
|
2022-06-02 22:25:57 +02:00
|
|
|
return 0
|
|
|
|
}
|
2022-06-05 21:54:08 +02:00
|
|
|
###############################################################################
|
|
|
|
########################## parsing with jq finished ###########################
|
|
|
|
###############################################################################
|
2022-06-02 16:03:24 +02:00
|
|
|
compute_hash () {
|
2022-06-06 20:07:47 +02:00
|
|
|
if cd_customer_repository; then
|
|
|
|
local hash=""
|
2022-06-07 22:32:46 +02:00
|
|
|
if [[ -z "$1" ]]; then
|
2022-06-06 20:07:47 +02:00
|
|
|
hash=$(git log -n 1 --pretty=format:%H)
|
|
|
|
else
|
2022-06-07 22:32:46 +02:00
|
|
|
hash=$(git hash-object "$1")
|
2022-06-06 20:07:47 +02:00
|
|
|
fi
|
2022-06-07 22:32:46 +02:00
|
|
|
cd_home ; echo ${hash:0:10} # return the first 10 hex characters
|
|
|
|
return 0
|
2022-06-06 20:07:47 +02:00
|
|
|
fi
|
2022-06-07 22:32:46 +02:00
|
|
|
return 1
|
2022-06-02 16:03:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
compute_version () {
|
|
|
|
VERSION="$MAJOR.$MINOR.$PATCH+$CUSTOMER_LOCATION-$(compute_hash)"
|
2022-06-06 20:07:47 +02:00
|
|
|
cd_home; return 0
|
|
|
|
return 1
|
2022-06-02 16:03:24 +02:00
|
|
|
}
|
|
|
|
|
2022-06-02 22:25:57 +02:00
|
|
|
check_sanity_of_repository () {
|
|
|
|
local func="${FUNCNAME[0]}"
|
2023-05-26 15:05:25 +02:00
|
|
|
|
|
|
|
if [ "$PWD" != "$WORKING_DIRECTORY" ]; then
|
|
|
|
log_fatal "$func:${LINENO} PD != WD ($PWD != $WORKING_DIRECTORY)"
|
|
|
|
fi
|
2022-06-07 21:50:03 +02:00
|
|
|
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_d CUSTOMER_ID_BASE_DIR
|
2022-06-06 20:07:47 +02:00
|
|
|
|
|
|
|
CUSTOMER_LOCATION_DIR="$CUSTOMER_ID_BASE_DIR"
|
|
|
|
#CUSTOMER_LOCATION_DIR="${CUSTOMER_ID_BASE_DIR}/${CUSTOMER_LOCATION}"
|
|
|
|
#CUST_LOC_DIR=$CUSTOMER_LOCATION_DIR
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_d CUSTOMER_LOCATION_DIR
|
2022-06-04 18:14:16 +02:00
|
|
|
|
2022-06-05 21:54:08 +02:00
|
|
|
# readonly zone_groups=(${__zone_groups[@]})
|
2022-06-06 18:53:30 +02:00
|
|
|
# by now (03.03.2023) there is only one zone group.
|
2022-06-06 20:07:47 +02:00
|
|
|
#readonly local __zgroup=1
|
|
|
|
#local __number_of_zone_groups=${ZONE_GROUPS[0]}
|
|
|
|
#local __zindex=1
|
|
|
|
#local __customer_base_dirs=("placeholder")
|
|
|
|
#for __zg in `seq 1 $__number_of_zone_groups`; do
|
|
|
|
# local __n_of_zones=${ZONE_GROUPS[$__zindex]}
|
|
|
|
# log_debug "$func:${LINENO}: zgroup $__zg has $__n_of_zones zones"
|
|
|
|
# for (( j=1; j<=$__n_of_zones; ++j)); do
|
|
|
|
# __customer_base_dirs+=("${CUSTOMER_LOCATION_DIR}/$__zgroup/$j")
|
|
|
|
# log_debug "$func:${LINENO}: zone $j"
|
|
|
|
# ((++__zindex))
|
|
|
|
# done
|
|
|
|
#done
|
2022-06-06 18:53:30 +02:00
|
|
|
|
2022-06-07 21:50:03 +02:00
|
|
|
# for szeged:
|
|
|
|
# placeholder
|
|
|
|
# /home/root/szeged/UpdateController/workspace/customer_281/szeged/1/1
|
|
|
|
# /home/root/szeged/UpdateController/workspace/customer_281/szeged/1/2
|
|
|
|
# /home/root/szeged/UpdateController/workspace/customer_281/szeged/1/3
|
2022-06-06 20:07:47 +02:00
|
|
|
# readonly CUST_BASE_DIRS=(${__customer_base_dirs[@]})
|
|
|
|
# assert_a CUST_BASE_DIRS
|
2022-06-07 21:50:03 +02:00
|
|
|
|
2022-06-12 13:10:48 +02:00
|
|
|
|
2022-06-06 20:07:47 +02:00
|
|
|
readonly CUST_BASE_DIR="$CUSTOMER_ID_BASE_DIR"
|
|
|
|
#readonly CUST_BASE_DIR="${CUST_BASE_DIRS[$ZONE]}"
|
|
|
|
#assert_d CUST_BASE_DIR
|
2022-06-07 21:50:03 +02:00
|
|
|
|
|
|
|
readonly ETC_SYS_DIR="/etc"
|
|
|
|
readonly ATB_SYS_DIR="/etc/atb"
|
|
|
|
readonly DC_SYS_DIR="/etc/dc"
|
2022-06-03 18:08:13 +02:00
|
|
|
readonly TARIFF_SYS_DIR="/etc/psa_tariff"
|
2022-06-07 21:50:03 +02:00
|
|
|
readonly OPKG_SYS_DIR="/etc/psa_update"
|
|
|
|
readonly CONF_SYS_DIR="/etc/psa_config"
|
|
|
|
readonly OPT_SYS_DIR="/opt"
|
|
|
|
readonly APP_SYS_DIR="/opt/app"
|
|
|
|
readonly SYSCONFIG_SYS_DIR="/opt/app/sysconfig"
|
|
|
|
readonly ATBAPP_SYS_DIR="/opt/app/ATBAPP"
|
|
|
|
readonly ISMASMGR_SYS_DIR="/opt/app/ISMASMgr"
|
|
|
|
|
|
|
|
readonly ETC_PSA_DIR=${CUST_BASE_DIR}${ETC_SYS_DIR}
|
|
|
|
readonly ATB_PSA_DIR=${CUST_BASE_DIR}${ATB_SYS_DIR}
|
|
|
|
readonly DC_PSA_DIR=${CUST_BASE_DIR}${DC_SYS_DIR}
|
|
|
|
readonly TARIFF_PSA_DIR=${CUST_BASE_DIR}${TARIFF_SYS_DIR}
|
|
|
|
readonly OPKG_PSA_DIR=${CUST_BASE_DIR}${OPKG_SYS_DIR}
|
|
|
|
readonly CONF_PSA_DIR=${CUST_BASE_DIR}${CONF_SYS_DIR}
|
|
|
|
readonly OPT_PSA_DIR=${CUST_BASE_DIR}${OPT_SYS_DIR}
|
|
|
|
readonly APP_PSA_DIR=${CUST_BASE_DIR}${APP_SYS_DIR}
|
|
|
|
readonly ATBAPP_PSA_DIR=${CUST_BASE_DIR}${ATBAPP_SYS_DIR}
|
|
|
|
readonly SYSCONFIG_PSA_DIR=${CUST_BASE_DIR}${SYSCONFIG_SYS_DIR}
|
|
|
|
readonly ISMASMGR_PSA_DIR=${CUST_BASE_DIR}${ISMASMGR_SYS_DIR}
|
|
|
|
|
2022-06-02 15:04:24 +02:00
|
|
|
readonly ATBQT_BIN="ATBQT"
|
2022-06-07 21:50:03 +02:00
|
|
|
readonly ATBQT_INI="ATBQT.ini"
|
|
|
|
readonly ISMASMGR_INI="ISMASMgr.ini"
|
|
|
|
readonly SYSCONF_INI="sysconfig.ini"
|
|
|
|
readonly SYSCTRL_INI="SystemControl.ini"
|
|
|
|
readonly TARIFF_CURRENT="tariff.current"
|
2023-06-05 15:07:05 +02:00
|
|
|
readonly DC="dc2c.bin"
|
2022-06-03 18:08:13 +02:00
|
|
|
readonly TARIFF_SUMMER="summer_tariff.json"
|
|
|
|
readonly TARIFF_WINTER="winter_tariff.json"
|
2022-06-07 21:50:03 +02:00
|
|
|
|
|
|
|
readonly DC_SYS_DC_FILE="${DC_SYS_DIR}/$DC"
|
2022-06-02 15:04:24 +02:00
|
|
|
readonly ATBQT_ATB_SYS_BIN_FILE="${ATBAPP_SYS_DIR}/$ATBQT_BIN"
|
2022-06-07 21:50:03 +02:00
|
|
|
readonly ATBQT_ATB_SYS_INI_FILE="${ATB_SYS_DIR}/$ATBQT_INI"
|
|
|
|
readonly ATBQT_APP_SYS_INI_FILE="${ATBAPP_SYS_DIR}/$ATBQT_INI"
|
|
|
|
readonly ATBQT_ETC_SYS_INI_FILE="${ETC_SYS_DIR}/$ATBQT_INI"
|
|
|
|
readonly ISMASMGRATB_SYS_INI_FILE="${ATB_SYS_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly ISMASMGRAPP_SYS_INI_FILE="${ISMASMGR_SYS_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly ISMASMGRETC_SYS_INI_FILE="${ETC_SYS_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly ISMASMGRSCF_SYS_INI_FILE="${SYSCONFIG_SYS_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly SYSCONF_ETC_SYS_INI_FILE="${ETC_SYS_DIR}/$SYSCONF_INI"
|
|
|
|
readonly SYSCONF_ATB_SYS_INI_FILE="${ATB_SYS_DIR}/$SYSCONF_INI"
|
|
|
|
readonly SYSCONF_SCF_SYS_INI_FILE="${SYSCONFIG_SYS_DIR}/$SYSCONF_INI"
|
|
|
|
readonly SYSCTRL_ETC_SYS_INI_FILE="${ETC_SYS_DIR}/$SYSCTRL_INI"
|
|
|
|
readonly SYSCTRL_ATB_SYS_INI_FILE="${ATB_SYS_DIR}/$SYSCTRL_INI"
|
|
|
|
readonly SYSCTRL_SCF_SYS_INI_FILE="${SYSCONFIG_SYS_DIR}/$SYSCTRL_INI"
|
2023-05-26 15:05:25 +02:00
|
|
|
# readonly ZONE_FILE="$ETC_SYS_DIR/zone_nr"
|
2022-06-07 21:50:03 +02:00
|
|
|
readonly CUST_ID_FILE="$ETC_SYS_DIR/cust_nr"
|
|
|
|
readonly TC_SYS_TC_FILE="${ATBAPP_SYS_DIR}/$TARIFF_CURRENT"
|
|
|
|
readonly OPKG_CMDS_SYS_FILE="${OPKG_SYS_DIR}/opkg_commands"
|
|
|
|
readonly DC2C_SYS_SERIAL_JSON="${CONF_SYS_DIR}/DC2C_serial.json"
|
|
|
|
readonly DC2C_SYS_CASH_JSON="${CONF_SYS_DIR}/DC2C_cash.json"
|
|
|
|
readonly DC2C_SYS_CONF_JSON="${CONF_SYS_DIR}/DC2C_conf.json"
|
|
|
|
readonly DC_PSA_DC_FILE="${DC_PSA_DIR}/$DC"
|
2022-06-03 18:08:13 +02:00
|
|
|
readonly TARIFF_SYS_SUMMER="${TARIFF_SYS_DIR}${TARIFF_SUMMER}"
|
|
|
|
readonly TARIFF_SYS_WINTER="${TARIFF_SYS_DIR}${TARIFF_WINTER}"
|
2022-06-07 21:50:03 +02:00
|
|
|
|
2022-06-02 22:09:21 +02:00
|
|
|
readonly ATBQT_ATB_PSA_INI_FILE="${ATB_PSA_DIR}/$ATBQT_INI"
|
|
|
|
readonly ATBQT_APP_PSA_INI_FILE="${ATBAPP_PSA_DIR}/$ATBQT_INI"
|
|
|
|
readonly ATBQT_ETC_PSA_INI_FILE="${ETC_PSA_DIR}/$ATBQT_INI"
|
2022-06-07 21:50:03 +02:00
|
|
|
readonly ISMASMGRATB_PSA_INI_FILE="${ATB_PSA_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly ISMASMGRAPP_PSA_INI_FILE="${ISMASMGR_PSA_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly ISMASMGRETC_PSA_INI_FILE="${ETC_PSA_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly ISMASMGRSCF_PSA_INI_FILE="${SYSCONFIG_PSA_DIR}/$ISMASMGR_INI"
|
|
|
|
readonly SYSCONF_ETC_PSA_INI_FILE="${ETC_PSA_DIR}/$SYSCONF_INI"
|
|
|
|
readonly SYSCONF_ATB_PSA_INI_FILE="${ATB_PSA_DIR}/$SYSCONF_INI"
|
|
|
|
readonly SYSCONF_SCF_PSA_INI_FILE="${SYSCONFIG_PSA_DIR}/$SYSCONF_INI"
|
2022-06-02 22:09:21 +02:00
|
|
|
readonly SYSCTRL_ETC_PSA_INI_FILE="${ETC_PSA_DIR}/$SYSCTRL_INI"
|
|
|
|
readonly SYSCTRL_ATB_PSA_INI_FILE="${ATB_PSA_DIR}/$SYSCTRL_INI"
|
|
|
|
readonly SYSCTRL_SCF_PSA_INI_FILE="${SYSCONFIG_PSA_DIR}/$SYSCTRL_INI"
|
2022-06-07 21:50:03 +02:00
|
|
|
readonly OPKG_CMDS_PSA_FILE="${OPKG_PSA_DIR}/opkg_commands"
|
|
|
|
readonly TC_PSA_TC_FILE="${ATBAPP_PSA_DIR}/$TARIFF_CURRENT"
|
2022-06-06 20:07:47 +02:00
|
|
|
# readonly PSA_UPDATE_CONF="${CUSTOMER_LOCATION_DIR}/update.conf"
|
2022-06-07 21:50:03 +02:00
|
|
|
readonly DC2C_PSA_SERIAL_JSON="${CONF_PSA_DIR}/DC2C_serial.json"
|
|
|
|
readonly DC2C_PSA_CASH_JSON="${CONF_PSA_DIR}/DC2C_cash.json"
|
|
|
|
readonly DC2C_PSA_CONF_JSON="${CONF_PSA_DIR}/DC2C_conf.json"
|
|
|
|
|
|
|
|
assert_d ETC_SYS_DIR
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_d ATB_SYS_DIR
|
2022-06-07 21:50:03 +02:00
|
|
|
assert_d DC_SYS_DIR
|
|
|
|
assert_d TARIFF_SYS_DIR
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_d OPKG_SYS_DIR
|
2022-06-07 21:50:03 +02:00
|
|
|
assert_d CONF_SYS_DIR
|
|
|
|
assert_d OPT_SYS_DIR
|
|
|
|
assert_d APP_SYS_DIR
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_d ATBAPP_SYS_DIR
|
2022-06-07 21:50:03 +02:00
|
|
|
assert_d SYSCONFIG_SYS_DIR
|
|
|
|
assert_d ISMASMGR_SYS_DIR
|
2022-06-04 18:14:16 +02:00
|
|
|
|
2022-06-07 21:50:03 +02:00
|
|
|
assert_d ETC_PSA_DIR
|
|
|
|
assert_d ATB_PSA_DIR
|
|
|
|
assert_d DC_PSA_DIR
|
|
|
|
assert_d TARIFF_PSA_DIR
|
|
|
|
assert_d OPKG_PSA_DIR
|
|
|
|
assert_d CONF_PSA_DIR
|
|
|
|
assert_d OPT_PSA_DIR
|
|
|
|
assert_d APP_PSA_DIR
|
|
|
|
assert_d ATBAPP_PSA_DIR
|
|
|
|
assert_d SYSCONFIG_PSA_DIR
|
|
|
|
assert_d ISMASMGR_PSA_DIR
|
|
|
|
|
|
|
|
assert_f DC_SYS_DC_FILE
|
|
|
|
assert_f ZONE_FILE
|
|
|
|
assert_f CUST_ID_FILE
|
2022-06-02 15:04:24 +02:00
|
|
|
assert_f ATBQT_ATB_SYS_BIN_FILE
|
2022-06-07 21:50:03 +02:00
|
|
|
assert_f ATBQT_ATB_SYS_INI_FILE
|
|
|
|
assert_f ATBQT_APP_SYS_INI_FILE
|
|
|
|
assert_f ATBQT_ETC_SYS_INI_FILE
|
|
|
|
assert_f ISMASMGRATB_SYS_INI_FILE
|
|
|
|
assert_f ISMASMGRAPP_SYS_INI_FILE
|
|
|
|
assert_f ISMASMGRETC_SYS_INI_FILE
|
|
|
|
assert_f ISMASMGRSCF_SYS_INI_FILE
|
|
|
|
assert_f SYSCONF_ETC_SYS_INI_FILE
|
|
|
|
assert_f SYSCONF_ATB_SYS_INI_FILE
|
|
|
|
assert_f SYSCONF_SCF_SYS_INI_FILE
|
|
|
|
assert_f SYSCTRL_ETC_SYS_INI_FILE
|
|
|
|
assert_f SYSCTRL_ATB_SYS_INI_FILE
|
|
|
|
assert_f SYSCTRL_SCF_SYS_INI_FILE
|
|
|
|
assert_f TC_SYS_TC_FILE
|
|
|
|
assert_f OPKG_CMDS_SYS_FILE
|
|
|
|
assert_f DC2C_SYS_CONF_JSON
|
|
|
|
assert_f DC2C_SYS_SERIAL_JSON
|
|
|
|
assert_f DC2C_SYS_CASH_JSON
|
|
|
|
|
|
|
|
assert_f DC_PSA_DC_FILE
|
|
|
|
assert_f ATBQT_ATB_PSA_INI_FILE
|
|
|
|
assert_f ATBQT_APP_PSA_INI_FILE
|
|
|
|
assert_f ATBQT_ETC_PSA_INI_FILE
|
|
|
|
assert_f ISMASMGRATB_PSA_INI_FILE
|
|
|
|
assert_f ISMASMGRAPP_PSA_INI_FILE
|
|
|
|
assert_f ISMASMGRETC_PSA_INI_FILE
|
|
|
|
assert_f ISMASMGRSCF_PSA_INI_FILE
|
|
|
|
assert_f SYSCONF_ETC_PSA_INI_FILE
|
|
|
|
assert_f SYSCONF_ATB_PSA_INI_FILE
|
|
|
|
assert_f SYSCONF_SCF_PSA_INI_FILE
|
|
|
|
assert_f SYSCTRL_ETC_PSA_INI_FILE
|
|
|
|
assert_f SYSCTRL_ATB_PSA_INI_FILE
|
|
|
|
assert_f SYSCTRL_SCF_PSA_INI_FILE
|
|
|
|
assert_f TC_PSA_TC_FILE
|
2022-06-06 20:07:47 +02:00
|
|
|
# assert_f PSA_UPDATE_CONF
|
2022-06-07 21:50:03 +02:00
|
|
|
assert_f OPKG_CMDS_PSA_FILE
|
|
|
|
assert_f DC2C_PSA_CONF_JSON
|
|
|
|
assert_f DC2C_PSA_SERIAL_JSON
|
|
|
|
assert_f DC2C_PSA_CASH_JSON
|
2022-06-04 22:06:44 +02:00
|
|
|
assert_f OPKG_CMDS_PSA_FILE
|
2022-06-07 21:50:03 +02:00
|
|
|
|
|
|
|
readonly KNOWN_SYS_DIRS=($ETC_SYS_DIR
|
|
|
|
$ATB_SYS_DIR
|
|
|
|
$DC_SYS_DIR
|
|
|
|
$TARIFF_SYS_DIR
|
|
|
|
$OPKG_SYS_DIR
|
|
|
|
$CONF_SYS_DIR
|
|
|
|
$OPT_SYS_DIR
|
|
|
|
$APP_SYS_DIR
|
|
|
|
$ATBAPP_SYS_DIR
|
|
|
|
$SYSCONFIG_SYS_DIR)
|
|
|
|
|
|
|
|
readonly KNOWN_PSA_DIRS=($ETC_PSA_DIR
|
|
|
|
$ATB_PSA_DIR
|
|
|
|
$DC_PSA_DIR
|
|
|
|
$TARIFF_PSA_DIR
|
|
|
|
$OPKG_PSA_DIR
|
|
|
|
$CONF_PSA_DIR
|
|
|
|
$OPT_PSA_DIR
|
|
|
|
$APP_PSA_DIR
|
|
|
|
$ATBAPP_PSA_DIR
|
|
|
|
$SYSCONFIG_PSA_DIR)
|
2022-06-02 21:52:10 +02:00
|
|
|
|
2022-06-06 18:53:30 +02:00
|
|
|
local DC2C_PRINT_JSON=()
|
|
|
|
for i in {1..32}; do # up to 32 print-json-files
|
2022-06-07 21:50:03 +02:00
|
|
|
local __f=${CONF_PSA_DIR}/DC2C_print$(printf "%02d" $i).json
|
2022-06-06 18:53:30 +02:00
|
|
|
readonly DC2C_PRINT$(printf "%02d" $i)_JSON=$__f
|
2022-06-05 21:42:53 +02:00
|
|
|
assert_f DC2C_PRINT$(printf "%02d" $i)_JSON
|
|
|
|
DC2C_PRINT_JSON+=($__f)
|
2022-06-06 18:53:30 +02:00
|
|
|
done
|
2022-06-03 18:08:13 +02:00
|
|
|
|
|
|
|
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
|
2022-06-06 18:53:30 +02:00
|
|
|
|
2022-06-06 20:07:47 +02:00
|
|
|
readonly KNOWN_CONF_FILES=(${DC2C_PRINT_JSON[@]##*${CUSTOMER_ID}/} \
|
2022-06-07 21:50:03 +02:00
|
|
|
${DC2C_PSA_CONF_JSON##*${CUSTOMER_ID}/} \
|
|
|
|
${DC2C_PSA_CASH_JSON##*${CUSTOMER_ID}/} \
|
|
|
|
${DC2C_PSA_SERIAL_JSON##*${CUSTOMER_ID}/})
|
2022-06-03 18:08:13 +02:00
|
|
|
|
|
|
|
readonly KNOWN_TARIFF_FILES=(${TARIFF_FILES_JSON[@]##*${CUSTOMER_ID}/})
|
2022-06-07 21:50:03 +02:00
|
|
|
|
|
|
|
readonly KNOWN_INI_FILES=(${ATBAPP_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${ISMASMGRATB_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${ISMASMGRAPP_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${ISMASMGRETC_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${ISMASMGRSCF_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${SYSCONF_ETC_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${SYSCONF_ATB_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${SYSCONF_SCF_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${SYSCTRL_ETC_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${SYSCTRL_ATB_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${SYSCTRL_SCF_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${ATBQT_ATB_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${ATBQT_APP_PSA_INI_FILE##*${CUSTOMER_ID}/} \
|
|
|
|
${ATBQT_ETC_PSA_INI_FILE##*${CUSTOMER_ID}/})
|
2022-06-02 22:25:57 +02:00
|
|
|
|
2022-06-02 22:09:21 +02:00
|
|
|
readonly KNOWN_FILES=(${KNOWN_CONF_FILES[@]} \
|
|
|
|
${KNOWN_INI_FILES[@]} \
|
2022-06-03 18:08:13 +02:00
|
|
|
${KNOWN_TARIFF_FILES[@]} \
|
2022-06-02 22:09:21 +02:00
|
|
|
${DC_PSA_DC_FILE##*${CUSTOMER_ID}/} \
|
2022-06-07 21:50:03 +02:00
|
|
|
${OPKG_CMDS_PSA_FILE##*${CUSTOMER_ID}/})
|
2022-06-03 21:47:55 +02:00
|
|
|
|
2022-06-16 15:49:00 +02:00
|
|
|
# log_debug "known json/ini/hex_files ->"
|
|
|
|
# for (( i=0; i < ${#KNOWN_FILES[@]}; ++i )); do
|
|
|
|
# tab=$'\t'
|
|
|
|
# log_debug "$tab$tab ${KNOWN_FILES[$i]}"
|
|
|
|
# done
|
2022-06-05 21:42:53 +02:00
|
|
|
log_debug "sanity of ${CUSTOMER_REPOSITORY_PATH} OK"
|
2022-06-02 16:03:24 +02:00
|
|
|
|
|
|
|
# compute version string for current (i.e. previous) version
|
|
|
|
compute_version
|
2022-06-04 21:29:23 +02:00
|
|
|
|
2022-06-04 18:14:16 +02:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
fi
|
2022-06-03 20:49:33 +02:00
|
|
|
|
2022-06-06 18:53:30 +02:00
|
|
|
|