Skip to content

Instantly share code, notes, and snippets.

@kitzy
Created April 2, 2018 22:10
Show Gist options
  • Save kitzy/1052b8c3c046057aacdde3398e2bf5ce to your computer and use it in GitHub Desktop.
Save kitzy/1052b8c3c046057aacdde3398e2bf5ce to your computer and use it in GitHub Desktop.
Expands the Jamf Pro ROOT.war, extracts the version number, and renames the ROOT.war file to include the version number.
#!/bin/bash
if [ -z $1 ]
then
echo "ROOT.war must be passed as the first arguement to this script!"
exit 1
fi
warFile=$1
mkdir -p '/tmp/jamf'
unzip $warFile -d '/tmp/jamf'
version=$(cat /tmp/jamf/WEB-INF/xml/version.xml | grep '<version>' -m 1 | awk -F '<|>|</' '{print $3}')
cp $1 "JSS_$version.war"
rm -rf '/tmp/jamf'
echo "Jamf Pro version is $version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment