Skip to content

Instantly share code, notes, and snippets.

@michaelnisi
Last active August 6, 2020 21:01
Show Gist options
  • Save michaelnisi/ba3ab93bf1c984135f4875a08d7f96bc to your computer and use it in GitHub Desktop.
Save michaelnisi/ba3ab93bf1c984135f4875a08d7f96bc to your computer and use it in GitHub Desktop.
Updating the version number in a iOS settings bundle
#!/usr/bin/env bash
set -o xtrace
SOURCE="${BASH_SOURCE[0]}"
if [[ -h $SOURCE ]]; then
SOURCE="$( readlink "$SOURCE" )"
fi
SOURCE_ROOT="${SOURCE_ROOT:-$( cd -P "$( dirname "$SOURCE" )/.." && pwd )}"
PLISTBUDDY=/usr/libexec/PlistBuddy
INFO_PLIST="$SOURCE_ROOT/Podest/Info.plist"
SETTINGS_PLIST="$SOURCE_ROOT/Settings.bundle/Root.plist"
VERSION_NUMBER="$($PLISTBUDDY -c 'Print CFBundleShortVersionString' $INFO_PLIST)"
BUILD_NUMBER="$($PLISTBUDDY -c 'Print CFBundleVersion' $INFO_PLIST)"
VERSION="$VERSION_NUMBER ($BUILD_NUMBER)"
$PLISTBUDDY -c "Set :PreferenceSpecifiers:0:DefaultValue $VERSION" $SETTINGS_PLIST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment