Skip to content

Instantly share code, notes, and snippets.

@lexrus
Created August 10, 2017 07:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lexrus/ba597b140697f02868127c0f78142a60 to your computer and use it in GitHub Desktop.
Save lexrus/ba597b140697f02868127c0f78142a60 to your computer and use it in GitHub Desktop.
Update version string in Settings.bundle
#!/bin/bash
PLISTBUDDY="/usr/libexec/PlistBuddy"
INFO_PLIST="$CODESIGNING_FOLDER_PATH/Info.plist"
SETTINGS_PLIST="$CODESIGNING_FOLDER_PATH/Settings.bundle/Root.plist"
VERSION_NUMBER="`$PLISTBUDDY -c \"Print CFBundleShortVersionString\" \"$INFO_PLIST\"`"
BUILD_NUMBER="`$PLISTBUDDY -c \"Print CFBundleVersion\" \"$INFO_PLIST\"`"
VERSION="Version $VERSION_NUMBER ($BUILD_NUMBER)"
GROUP_INDEX="`xmllint --xpath \"count(//array/dict)-1\" \"$SETTINGS_PLIST\"`"
$PLISTBUDDY -c "Set :PreferenceSpecifiers:$GROUP_INDEX:Title '$VERSION'" "$SETTINGS_PLIST"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment