forked from gnachman/iTerm2
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathversion.sh
executable file
·37 lines (33 loc) · 871 Bytes
/
version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
PB=/usr/libexec/PlistBuddy
getVersion() {
cat version.txt
}
setBundleVersion() {
VERSION="$1"
APPDIR="$2"
PLISTFILE="$APPDIR/Contents/Info.plist"
if [ -f "${PLISTFILE}" ]; then
$PB -c "Set :CFBundleVersion ${VERSION}" ${PLISTFILE}
$PB -c "Set :CFBundleShortVersionString ${VERSION}" "${PLISTFILE}"
codesign --force --options runtime --sign - --entitlements Therm.entitlements "$APPDIR"
else
echo "Ignore $APPDIR"
fi
}
setVersion() {
VERSION="$1"
echo $VERSION > version.txt
echo "#define THERM_VERSION \"$VERSION\"" > config.h
[ -d 'build/Deployment/Therm.app' ] && \
setBundleVersion $VERSION 'build/Deployment/Therm.app'
[ -d 'build/Development/Therm.app' ] && \
setBundleVersion $VERSION 'build/Development/Therm.app'
}
if [ -z "$1" ]; then
getVersion
elif [ "$1" = "-f" ]; then
setVersion `getVersion`
else
setVersion "$1"
fi