Extract WireGuardGo version at build time.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
sed=$(sh /etc/profile; which sed)
|
||||
wireguard_go_version=$("$sed" -n 's/.*WireGuardGoVersion = "\(.*\)\".*/\1/p' wireguard-go/version.go)
|
||||
|
||||
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
|
||||
echo $wireguard_go_version
|
||||
/usr/libexec/PlistBuddy -c "Set :WireGuardGoVersion $wireguard_go_version" "$plist"
|
||||
fi
|
||||
done
|
||||
|
||||
settings_root_plist="$TARGET_BUILD_DIR/WireGuard.app/Settings.bundle/Root.plist"
|
||||
|
||||
if [ -f "$settings_root_plist" ]; then
|
||||
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:2:DefaultValue $wireguard_go_version" "$settings_root_plist"
|
||||
else
|
||||
echo "Could not find: $settings_root_plist"
|
||||
exit 1
|
||||
fi
|
||||
@@ -7,13 +7,17 @@ number_of_commits=$("$git" rev-list HEAD --count)
|
||||
date_timestamp=$("$date" +%Y%m%d)
|
||||
|
||||
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
|
||||
echo $target_plist
|
||||
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"
|
||||
echo $dsym_plist
|
||||
|
||||
for plist in "$target_plist" "$dsym_plist"; do
|
||||
if [ -f "$plist" ]; then
|
||||
echo $date_timestamp
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${number_of_commits}" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString 0.0.${date_timestamp}" "$plist"
|
||||
echo $plist
|
||||
echo $number_of_commits
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $number_of_commits" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString 0.0.$date_timestamp" "$plist"
|
||||
|
||||
fi
|
||||
done
|
||||
@@ -28,3 +32,4 @@ else
|
||||
echo "Could not find: $settings_root_plist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user