diff options
author | DT Netsolution GmbH <[email protected]> | 2012-02-06 13:20:56 (GMT) |
---|---|---|
committer | DT Netsolution GmbH <[email protected]> | 2012-02-06 13:20:56 (GMT) |
commit | 02fac0f3d14c3f2a123f559faffdd3d5fd9cdf55 (patch) | |
tree | 5ace586a59e9b87adb8b514434037c6df1f35dd8 /lib/builder-utils.sh | |
parent | a045ccb81704c9533fb839be38344c424418c541 (diff) |
Fix: fix autopurging bug (probs mit sorting ..)
New: Added new RELEASE-incrementing algorithm dependent on the VERSION.
Refer to opsi-builder.cfg:STATUS_INTEGRATION_RELEASE="func:inc1"
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 9c8f3b9..1fb28f3 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -224,3 +224,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 +} |