Update version.swift and make_swift_munki_pkg.sh so that build number is in the command-line tools version output

This commit is contained in:
Greg Neagle
2025-05-19 13:16:54 -07:00
parent 873fda98a9
commit 04b2ccb7c3
2 changed files with 12 additions and 1 deletions
+5
View File
@@ -20,8 +20,13 @@
/// one single place to define a version for CLI tools
let CLI_TOOLS_VERSION = "7.0.0"
let BUILD = "<BUILD_GOES_HERE>"
/// Returns version of Munki tools
func getVersion() -> String {
if let build = Int(BUILD) {
// BUILD was updated to an integer by the build script
return "\(CLI_TOOLS_VERSION).\(BUILD)"
}
return CLI_TOOLS_VERSION
}
+7 -1
View File
@@ -182,7 +182,7 @@ VERSIONFILE="$MUNKIROOT/code/cli/munki/shared/version.swift"
# Check to see if file exists
if [ -f "${VERSIONFILE}" ]; then
# Get the munki version
MUNKIVERS=$(grep CLI_TOOLS_VERSION "${VERSIONFILE}" | awk -F'"' '$0=$2')
MUNKIVERS=$(grep "let CLI_TOOLS_VERSION =" "${VERSIONFILE}" | awk -F'"' '$0=$2')
if [ "$?" != "0" ]; then
echo "${VERSIONFILE} can not be read" 1>&2
exit 1
@@ -343,6 +343,9 @@ else
fi
echo
# modify version.swift to contain build number
sed -i.bak "s/<BUILD_GOES_HERE>/${SVNREV}/g" "${VERSIONFILE}"
# Build munki cli tools
echo "Building munki cli tools..."
"${MUNKIROOT}/code/tools/build_swift_munki.sh" > /dev/null
@@ -352,6 +355,9 @@ if [ "$MUNKICLI_RESULT" -ne 0 ]; then
exit 2
fi
# reset build number in version.swift
mv "${VERSIONFILE}.bak" "${VERSIONFILE}"
# Build Managed Software Center.
echo "Building Managed Software Center.xcodeproj..."
pushd "$MUNKIROOT/code/apps/Managed Software Center" > /dev/null