made to be sourced only once
This commit is contained in:
parent
87d50bd5b2
commit
e3ae2e8d36
32
read_config
32
read_config
@ -1,17 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# set -x
|
# set -x
|
||||||
|
|
||||||
#if [ ${read_config_sourced:-1} = "1" ]; then
|
source ./log_helpers
|
||||||
# readonly read_config_sourced=${BASH_SOURCE[0]}
|
|
||||||
#else
|
|
||||||
# return 0
|
|
||||||
#fi
|
|
||||||
|
|
||||||
# source ./log_helpers
|
if [ ${read_config_sourced:-1} = "1" ]; then # include only once
|
||||||
|
readonly read_config_sourced=${BASH_SOURCE[0]}
|
||||||
|
|
||||||
# read config file (JSON syntax)
|
# read config file (JSON syntax)
|
||||||
#
|
#
|
||||||
read_config() {
|
read_config() {
|
||||||
local func="${FUNCNAME[0]}"
|
local func="${FUNCNAME[0]}"
|
||||||
|
|
||||||
# check customer_id
|
# check customer_id
|
||||||
@ -43,27 +40,34 @@ read_config() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# check customer_location
|
# check customer_location
|
||||||
local customer_location="$(cat "$1" | jq -r .customer_location)"
|
local customer_location=$(cat "$1" | jq -r .customer_location)
|
||||||
if [ -z "$customer_location" ]; then
|
if [ -z "$customer_location" ]; then
|
||||||
log_fatal "$func:${LINENO}: customer_location not set in $1"
|
log_fatal "$func:${LINENO}: customer_location not set in $1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
readonly working_directory="$(cat "$1" | jq -r .working_directory)"
|
readonly working_directory="$(cat "$1" | jq -r .working_directory)"
|
||||||
|
|
||||||
log_info "$func:${LINENO}: working_directory is $working_directory"
|
log_info "$func:${LINENO}: working_directory is $working_directory"
|
||||||
|
|
||||||
readonly workspace_dir="$(cat "$1" | jq -r .workspace_dir)"
|
readonly workspace_dir="$(cat "$1" | jq -r .workspace_dir)"
|
||||||
|
|
||||||
local __customer_base_dir="$working_directory/${workspace_dir}"
|
local __customer_base_dir="$working_directory/${workspace_dir}"
|
||||||
__customer_base_dir="${__customer_base_dir}/${customer_id}"
|
__customer_base_dir="${__customer_base_dir}/${customer_id}"
|
||||||
__customer_base_dir="${__customer_base_dir}/${customer_location}"
|
__customer_base_dir="${__customer_base_dir}/${customer_location}"
|
||||||
|
|
||||||
|
readonly customer_location_dir="$__customer_base_dir"
|
||||||
|
|
||||||
|
log_info "$func:${LINENO}: customer-location-dir is $customer_location_dir"
|
||||||
|
|
||||||
readonly customer_base_dir="${__customer_base_dir}/${zone_group}/${zone}"
|
readonly customer_base_dir="${__customer_base_dir}/${zone_group}/${zone}"
|
||||||
|
|
||||||
log_info "$func:${LINENO}: customer-base-dir is $customer_base_dir"
|
log_info "$func:${LINENO}: customer-base-dir is $customer_base_dir"
|
||||||
|
|
||||||
readonly opkg_cmds_file="${customer_base_dir}/etc/psa_update/opkg_commands"
|
readonly opkg_cmds_file="${customer_base_dir}/etc/psa_update/opkg_commands"
|
||||||
|
|
||||||
log_info "$func:${LINENO}: opkg_cmds_file is $opkg_cmds_file"
|
log_info "$func:${LINENO}: opkg_cmds_file is $opkg_cmds_file"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
# read_config UpdateController.conf
|
||||||
# read_config UpdateController.conf
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user