2018-05-23 19:49:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
git=$(sh /etc/profile; which git)
|
2018-09-26 07:30:14 +00:00
|
|
|
date=$(sh /etc/profile; which date)
|
|
|
|
|
2018-05-23 19:49:10 +00:00
|
|
|
number_of_commits=$("$git" rev-list HEAD --count)
|
2018-09-26 07:30:14 +00:00
|
|
|
date_timestamp=$("$date" +%Y%m%d)
|
2018-05-23 19:49:10 +00:00
|
|
|
|
|
|
|
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
|
|
|
|
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"
|
|
|
|
|
|
|
|
for plist in "$target_plist" "$dsym_plist"; do
|
|
|
|
if [ -f "$plist" ]; then
|
2018-09-26 07:30:14 +00:00
|
|
|
echo $date_timestamp
|
2018-05-23 19:49:10 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${number_of_commits}" "$plist"
|
2018-09-26 07:30:14 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString 0.0.${date_timestamp}" "$plist"
|
|
|
|
|
2018-05-23 19:49:10 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-05-24 18:13:21 +00:00
|
|
|
settings_root_plist="$TARGET_BUILD_DIR/WireGuard.app/Settings.bundle/Root.plist"
|
2018-05-23 19:49:10 +00:00
|
|
|
|
|
|
|
if [ -f "$settings_root_plist" ]; then
|
|
|
|
settingsVersion="`agvtool what-marketing-version -terse1`(${number_of_commits})"
|
|
|
|
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $settingsVersion" "$settings_root_plist"
|
2018-09-26 07:30:14 +00:00
|
|
|
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue 0.0.$date_timestamp" "$settings_root_plist"
|
2018-05-23 19:49:10 +00:00
|
|
|
else
|
|
|
|
echo "Could not find: $settings_root_plist"
|
|
|
|
exit 1
|
2018-09-26 07:30:14 +00:00
|
|
|
fi
|