Added compute_hash() and compute_version()

This commit is contained in:
Gerhard Hoffmann 2022-06-02 16:03:24 +02:00
parent ec660a9fad
commit 4b6723b8e6

View File

@ -6,6 +6,10 @@ source ./general_utils
if [ ${read_config_sourced:-1} = "1" ]; then # include only once if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly read_config_sourced=${BASH_SOURCE[0]} readonly read_config_sourced=${BASH_SOURCE[0]}
readonly MAJOR="0"
readonly MINOR="1"
readonly PATCH="0"
readonly DATEFLAGS="+%Y.%m.%dT%H.%M.%S" readonly DATEFLAGS="+%Y.%m.%dT%H.%M.%S"
readonly STRIPCOMMENTS='sed -e s/#.*$//g' readonly STRIPCOMMENTS='sed -e s/#.*$//g'
@ -19,8 +23,6 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly UPDATEPSAEND=./.updatepsa/end readonly UPDATEPSAEND=./.updatepsa/end
readonly PROGRAM=`basename $0` readonly PROGRAM=`basename $0`
readonly VERSION="0.8.0"
readonly WORKSPACE_DIR=workspace readonly WORKSPACE_DIR=workspace
WORKING_DIRECTORY=${WORKING_DIRECTORY:-$UPDATEPSAHOME} WORKING_DIRECTORY=${WORKING_DIRECTORY:-$UPDATEPSAHOME}
@ -83,12 +85,24 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
readonly ZONE_GROUPS=(${__zone_groups[@]}) readonly ZONE_GROUPS=(${__zone_groups[@]})
assert_a ZONE_GROUPS assert_a ZONE_GROUPS
return 0 return 0
} }
############################################################################### ###############################################################################
########################## parsing with jq finished ########################### ########################## parsing with jq finished ###########################
############################################################################### ###############################################################################
compute_hash () {
# TODO: wie genau soll der hash-wert berechnet werden ?
HASH="12345abc"
# HASH_="67890def"
echo $HASH
}
compute_version () {
VERSION="$MAJOR.$MINOR.$PATCH+$CUSTOMER_LOCATION-$(compute_hash)"
}
check_sanity_of_repository () { check_sanity_of_repository () {
local func="${FUNCNAME[0]}" local func="${FUNCNAME[0]}"
@ -267,6 +281,9 @@ if [ ${read_config_sourced:-1} = "1" ]; then # include only once
log_debug "$tab$tab ${KNOWN_FILES[$i]}" log_debug "$tab$tab ${KNOWN_FILES[$i]}"
done done
log_debug "sanity of ${CUSTOMER_REPOSITORY_PATH} OK" log_debug "sanity of ${CUSTOMER_REPOSITORY_PATH} OK"
# compute version string for current (i.e. previous) version
compute_version
return 0 return 0
} }