-
Notifications
You must be signed in to change notification settings - Fork 19
/
gen_plist.sh
70 lines (61 loc) · 1.75 KB
/
gen_plist.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Generates an xml structured plist with the minimum required entries from inner info.plist in ipa
unzip "$ipa_path" > /dev/null
last_find_app_path=""
find_apps_count=0
find_apps_output="$(find . -path "./Payload/*.app" -maxdepth 2 -mindepth 2)"
if [[ "${find_apps_output}" != "" ]] ; then
while IFS= read -r app
do
find_apps_count=$(($find_apps_count + 1))
last_find_app_path=$app
done <<< "${find_apps_output}"
fi
if [ "$find_apps_count" -eq 0 ] ; then
echo "No .app found in ipa"
exit 1
fi
if [ "$find_apps_count" -gt 1 ] ; then
echo "$find_apps_count .app found in ipa"
exit 1
fi
APP_BASE_NAME=${last_find_app_path##*/}
APP_NAME=${APP_BASE_NAME%.app}
BUNDLEID=`/usr/libexec/PlistBuddy -c "Print :CFBundleIdentifier" ./Payload/"$APP_BASE_NAME"/Info.plist`
BUNDLESHORTVER=`/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" ./Payload/"$APP_BASE_NAME"/Info.plist`
generated_plist_path="./Info.plist"
if [ -e "${generated_plist_path}" ]; then
rm "${generated_plist_path}"
fi
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>items</key>
<array>
<dict>
<key>assets</key>
<array>
<dict>
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>$S3_DEPLOY_STEP_URL_IPA</string>
</dict>
</array>
<key>metadata</key>
<dict>
<key>bundle-identifier</key>
<string>$BUNDLEID</string>
<key>bundle-version</key>
<string>$BUNDLESHORTVER</string>
<key>kind</key>
<string>software</string>
<key>title</key>
<string>$APP_NAME</string>
</dict>
</dict>
</array>
</dict>
</plist>" > "${generated_plist_path}"
rm -rf ./Payload