Replaced CLONE_CUSTOMER_REPOSITORY by INITIAL_CLONE.

Added some sanity checks at end of read_config().
This commit is contained in:
Gerhard Hoffmann 2023-05-26 15:05:25 +02:00
parent e356456fb5
commit 901fa4c319

View File

@ -30,9 +30,7 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly WORKSPACE_DIR=workspace
EXITCODE=$RC_SUCCESS
CLONE_CUSTOMER_REPOSITORY=false
GIT_CLONE_EXECUTED=0
INITIAL_CLONE=false
APISM_RUNNING=0
# read config file (JSON syntax)
@ -90,10 +88,23 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
# Zone aus /etc/zone_nr auslesen
#
readonly ZONE_GROUP=1
readonly ZONE=1
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
readonly LOCAL_BRANCH="$(cat "$cf" | jq -r .local_branches[$ZONE])"
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"
return 0
}
###############################################################################
@ -121,6 +132,10 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
check_sanity_of_repository () {
local func="${FUNCNAME[0]}"
if [ "$PWD" != "$WORKING_DIRECTORY" ]; then
log_fatal "$func:${LINENO} PD != WD ($PWD != $WORKING_DIRECTORY)"
fi
assert_d CUSTOMER_ID_BASE_DIR
@ -207,7 +222,7 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
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"
readonly ZONE_FILE="$ETC_SYS_DIR/zone_nr"
# readonly ZONE_FILE="$ETC_SYS_DIR/zone_nr"
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"