diff options
author | Mario Fetka <[email protected]> | 2012-02-12 06:56:10 (GMT) |
---|---|---|
committer | Mario Fetka <[email protected]> | 2012-02-12 06:56:10 (GMT) |
commit | 1704cc8fcf8b7d1e0b15636a901bfd218b7bb440 (patch) | |
tree | 272a7d6049419675656fd17ac661ae146aa8dde5 /lib/builder-utils.sh | |
parent | a237b47cfde9136c0032e647f372a13b7c0bcf1e (diff) | |
parent | 7b88ef224be45d4ca0aa863ab7a0ccfa60d8d9ba (diff) |
Merge branch 'master' of disconnected-by-peer.at:go-opsi/devtools
Diffstat (limited to 'lib/builder-utils.sh')
-rw-r--r-- | lib/builder-utils.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 737c65a..2fa5bb9 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -227,3 +227,36 @@ create_winst_varfile() { echo >>$var_file } + +##################### +# void calc_release() +# +# Description: +# Calculate new release based on +# the latest one found in the repository. +# +# $RELEASE is set to the calculated release. +# +#################### +function calc_release() { + + # Find all revision files and sort them + local file_list=`mktemp /tmp/opsi-builder.calc_release.XXXXXXXXXXX` + for cfg_file in `find ${OPSI_REPOS_BASE_DIR} -name "${PN}-${VERSION}-${CREATOR_TAG}*.cfg" -print ` ; do + . ${cfg_file} + printf "%08d;$cfg_file\n" $REV_RELEASE >> ${file_list} + done + local oldest_cfg=`sort -n ${file_list} | cut -f 2 -d ";" | tail -1` + rm -f ${file_list} + + if [ ! -f "${oldest_cfg}" ] ; then + echo "Warning: no cfg-file found for this product. RELEASE will be set to 1" + RELEASE=1 + else + log_debug "calc_release() oldest_cfg: ${oldest_cfg}" + . ${oldest_cfg} + log_debug " latest release: $REV_RELEASE" + RELEASE=`expr ${REV_RELEASE} + 1 2> /dev/null` + builder_check_error "Cannot incrememnt REV_RELEASE from file ${oldest_cfg}" + fi +} |