sigh 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -6
- data/bin/sigh +16 -1
- data/lib/assets/resign.sh +201 -71
- data/lib/sigh/resign.rb +19 -12
- data/lib/sigh/runner.rb +1 -1
- data/lib/sigh/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 310f1a18571628069c1c4730cdce58d7ba17d2a2
|
4
|
+
data.tar.gz: e44e6ea604939d78861cc77179be6c9822ecdc3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb2d7905de6218ce67bf8b2d22cdb8869f6017c1d58b2e7c5679eaf36add7a0913ceade5f2fe750537da80c847bcec30ee59e54ac860737991040ce0bd9167de
|
7
|
+
data.tar.gz: 77141a2f7120b3e7f8058ad0efacd5c7e394cca0991b9639081d10236eb7b6146f327f65e1902fb37980710c11b4fea2c17a58e19b2a4d3e986621577ea77a80
|
data/README.md
CHANGED
@@ -13,17 +13,16 @@
|
|
13
13
|
<b>sigh</b> •
|
14
14
|
<a href="https://github.com/KrauseFx/produce">produce</a> •
|
15
15
|
<a href="https://github.com/KrauseFx/cert">cert</a> •
|
16
|
-
<a href="https://github.com/KrauseFx/codes">codes</a> •
|
17
16
|
<a href="https://github.com/fastlane/spaceship">spaceship</a> •
|
18
17
|
<a href="https://github.com/fastlane/pilot">pilot</a> •
|
19
18
|
<a href="https://github.com/fastlane/boarding">boarding</a> •
|
20
|
-
<a href="https://github.com/fastlane/gym">gym</a>
|
21
|
-
|
19
|
+
<a href="https://github.com/fastlane/gym">gym</a> •
|
20
|
+
<a href="https://github.com/fastlane/scan">scan</a>
|
22
21
|
</p>
|
23
22
|
-------
|
24
23
|
|
25
24
|
<p align="center">
|
26
|
-
|
25
|
+
<img src="assets/sigh.png" height="110">
|
27
26
|
</p>
|
28
27
|
|
29
28
|
sigh
|
@@ -202,12 +201,11 @@ If you're using [cert](https://github.com/KrauseFx/cert) in combination with [fa
|
|
202
201
|
- [`PEM`](https://github.com/KrauseFx/pem): Automatically generate and renew your push notification profiles
|
203
202
|
- [`produce`](https://github.com/KrauseFx/produce): Create new iOS apps on iTunes Connect and Dev Portal using the command line
|
204
203
|
- [`cert`](https://github.com/KrauseFx/cert): Automatically create and maintain iOS code signing certificates
|
205
|
-
- [`codes`](https://github.com/KrauseFx/codes): Create promo codes for iOS Apps using the command line
|
206
204
|
- [`spaceship`](https://github.com/fastlane/spaceship): Ruby library to access the Apple Dev Center and iTunes Connect
|
207
205
|
- [`pilot`](https://github.com/fastlane/pilot): The best way to manage your TestFlight testers and builds from your terminal
|
208
206
|
- [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
|
209
207
|
- [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
|
210
|
-
|
208
|
+
- [`scan`](https://github.com/fastlane/scan): The easiest way to run tests of your iOS and Mac app
|
211
209
|
|
212
210
|
##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
|
213
211
|
|
data/bin/sigh
CHANGED
@@ -60,7 +60,10 @@ class SighApplication
|
|
60
60
|
c.syntax = 'sigh resign'
|
61
61
|
c.description = 'Resigns an existing ipa file with the given provisioning profile'
|
62
62
|
c.option '-i', '--signing_identity STRING', String, 'The signing identity to use. Must match the one defined in the provisioning profile.'
|
63
|
-
c.option '-p', '--provisioning_profile
|
63
|
+
c.option '-p', '--provisioning_profile PATH', String, '(or BUNDLE_ID=PATH) The path to the provisioning profile which should be used.'\
|
64
|
+
'Can be provided multiple times if the application contains nested applications and app extensions, which need their own provisioning profile.'\
|
65
|
+
'The path may be prefixed with a identifier in order to determine which provisioning profile should be used on which app.',
|
66
|
+
&multiple_values_option_proc(c, "provisioning_profile", &proc { |value| value.split('=', 2) })
|
64
67
|
|
65
68
|
c.action do |args, options|
|
66
69
|
Sigh::Resign.new.run(options, args)
|
@@ -85,6 +88,18 @@ class SighApplication
|
|
85
88
|
|
86
89
|
run!
|
87
90
|
end
|
91
|
+
|
92
|
+
def multiple_values_option_proc(command, name)
|
93
|
+
proc do |value|
|
94
|
+
value = yield(value) if block_given?
|
95
|
+
option = command.proxy_options.find { |opt| opt[0] == name } || []
|
96
|
+
values = option[1] || []
|
97
|
+
values << value
|
98
|
+
|
99
|
+
command.proxy_options.delete option
|
100
|
+
command.proxy_options << [name, values]
|
101
|
+
end
|
102
|
+
end
|
88
103
|
end
|
89
104
|
|
90
105
|
begin
|
data/lib/assets/resign.sh
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
#!/bin/bash
|
2
2
|
|
3
3
|
# Copyright (c) 2011 Float Mobile Learning
|
4
4
|
# http://www.floatlearning.com/
|
@@ -12,6 +12,8 @@
|
|
12
12
|
# Extended by John Turnipseed and Matthew Nespor, November 2014
|
13
13
|
# http://nanonation.net/
|
14
14
|
#
|
15
|
+
# Extended by Nicolas Bachschmidt, October 2015
|
16
|
+
#
|
15
17
|
# Permission is hereby granted, free of charge, to any person obtaining
|
16
18
|
# a copy of this software and associated documentation files (the "Software"),
|
17
19
|
# to deal in the Software without restriction, including without limitation
|
@@ -31,7 +33,7 @@
|
|
31
33
|
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
32
34
|
#
|
33
35
|
# Please let us know about any improvements you make to this script!
|
34
|
-
# ./floatsign source "iPhone Distribution: Name" -p "path/to/profile" [-d "display name"] [-e entitlements] [-k keychain] -b "BundleIdentifier" outputIpa
|
36
|
+
# ./floatsign source "iPhone Distribution: Name" -p "path/to/profile" [-d "display name"] [-e entitlements] [-k keychain] [-b "BundleIdentifier"] outputIpa
|
35
37
|
#
|
36
38
|
#
|
37
39
|
# Modifed 26th January 2012
|
@@ -50,6 +52,11 @@
|
|
50
52
|
# 4. renamed 'temp' directory and made it a variable so it can be easily modified
|
51
53
|
# 5. various code formatting and logging adjustments
|
52
54
|
#
|
55
|
+
# new features October 2015
|
56
|
+
# 1. now re-signs nested applications and app extensions, if present, prior to re-signing the application itself
|
57
|
+
# 2. enables the -p option to be used more than once
|
58
|
+
# 2. ensures the provisioning profile's bundle-identifier matches the app's bundle identifier
|
59
|
+
#
|
53
60
|
|
54
61
|
|
55
62
|
function checkStatus {
|
@@ -62,24 +69,24 @@ fi
|
|
62
69
|
}
|
63
70
|
|
64
71
|
if [ $# -lt 3 ]; then
|
65
|
-
echo "usage: $0 source identity -p provisioning [-e entitlements] [-r adjustBetaReports] [-d displayName] [-n version] -b bundleId outputIpa" >&2
|
66
|
-
echo " -p
|
67
|
-
echo " -r flag requires a value '-r yes'"
|
72
|
+
echo "usage: $0 source identity -p provisioning [-e entitlements] [-r adjustBetaReports] [-d displayName] [-n version] [-b bundleId] outputIpa" >&2
|
73
|
+
echo " -p option may be provided multiple times" >&2
|
74
|
+
echo " -r flag requires a value '-r yes'" >&2
|
68
75
|
echo " -r flag is ignored if -e is also used" >&2
|
69
76
|
exit 1
|
70
77
|
fi
|
71
78
|
|
72
79
|
ORIGINAL_FILE="$1"
|
73
80
|
CERTIFICATE="$2"
|
74
|
-
NEW_PROVISION=
|
75
81
|
ENTITLEMENTS=
|
76
82
|
BUNDLE_IDENTIFIER=""
|
77
83
|
DISPLAY_NAME=""
|
78
|
-
APP_IDENTIFER_PREFIX=""
|
79
|
-
TEAM_IDENTIFIER=""
|
80
84
|
KEYCHAIN=""
|
81
85
|
VERSION_NUMBER=""
|
82
86
|
ADJUST_BETA_REPORTS_ACTIVE_FLAG="0"
|
87
|
+
RAW_PROVISIONS=()
|
88
|
+
PROVISIONS_BY_ID=()
|
89
|
+
DEFAULT_PROVISION=""
|
83
90
|
TEMP_DIR="_floatsignTemp"
|
84
91
|
|
85
92
|
# options start index
|
@@ -87,8 +94,12 @@ OPTIND=3
|
|
87
94
|
while getopts p:d:e:k:b:r:n: opt; do
|
88
95
|
case $opt in
|
89
96
|
p)
|
90
|
-
|
91
|
-
|
97
|
+
RAW_PROVISIONS+=("$OPTARG")
|
98
|
+
if [[ "$OPTARG" =~ .+=.+ ]]; then
|
99
|
+
echo "Specified provisioning profile: '${OPTARG#*=}' for bundle identifier: '${OPTARG%%=*}'" >&2
|
100
|
+
else
|
101
|
+
echo "Specified provisioning profile: '$OPTARG'" >&2
|
102
|
+
fi
|
92
103
|
;;
|
93
104
|
d)
|
94
105
|
DISPLAY_NAME="$OPTARG"
|
@@ -134,6 +145,10 @@ then
|
|
134
145
|
exit 1
|
135
146
|
fi
|
136
147
|
|
148
|
+
if [[ "${#RAW_PROVISIONS[*]}" == "0" ]]; then
|
149
|
+
echo "-p 'xxxx.mobileprovision' argument is required" >&2
|
150
|
+
exit 1;
|
151
|
+
fi
|
137
152
|
|
138
153
|
# Check for and remove the temporary directory if it already exists
|
139
154
|
if [ -d "$TEMP_DIR" ];
|
@@ -178,24 +193,140 @@ APP_NAME=$(ls "$TEMP_DIR/Payload/")
|
|
178
193
|
# Make sure that PATH includes the location of the PlistBuddy helper tool as its location is not standard
|
179
194
|
export PATH=$PATH:/usr/libexec
|
180
195
|
|
196
|
+
# Test whether two bundle identifiers match
|
197
|
+
# The first one may contain the wildcard character '*', in which case pattern matching will be used unless the third parameter is "STRICT"
|
198
|
+
function does_bundle_id_match {
|
199
|
+
|
200
|
+
if [[ "$1" == "$2" ]]; then
|
201
|
+
return 0
|
202
|
+
elif [[ "$3" != STRICT && "$1" =~ \* ]]; then
|
203
|
+
local PATTERN0="${1//\./\\.}" # com.example.* -> com\.example\.*
|
204
|
+
local PATTERN1="${PATTERN0//\*/.*}" # com\.example\.* -> com\.example\..*
|
205
|
+
if [[ "$2" =~ ^$PATTERN1$ ]]; then
|
206
|
+
return 0
|
207
|
+
fi
|
208
|
+
fi
|
209
|
+
|
210
|
+
return 1
|
211
|
+
}
|
212
|
+
|
213
|
+
# Find the provisioning profile for a given bundle identifier
|
214
|
+
function provision_for_bundle_id {
|
215
|
+
|
216
|
+
for ARG in "${PROVISIONS_BY_ID[@]}"; do
|
217
|
+
if does_bundle_id_match "${ARG%%=*}" "$1" "$2"; then
|
218
|
+
echo "${ARG#*=}"
|
219
|
+
break
|
220
|
+
fi
|
221
|
+
done
|
222
|
+
}
|
223
|
+
|
224
|
+
# Find the bundle identifier contained inside a provisioning profile
|
225
|
+
function bundle_id_for_provison {
|
226
|
+
|
227
|
+
local FULL_BUNDLE_ID=`PlistBuddy -c 'Print :Entitlements:application-identifier' /dev/stdin <<< $(security cms -D -i "$1")`
|
228
|
+
checkStatus
|
229
|
+
echo "${FULL_BUNDLE_ID#*.}"
|
230
|
+
}
|
231
|
+
|
232
|
+
# Add given provisioning profile and bundle identifier to the search list
|
233
|
+
function add_provision_for_bundle_id {
|
234
|
+
|
235
|
+
local PROVISION="$1"
|
236
|
+
local BUNDLE_ID="$2"
|
237
|
+
|
238
|
+
local CURRENT_PROVISION=`provision_for_bundle_id "$BUNDLE_ID" STRICT`
|
239
|
+
|
240
|
+
if [[ "$CURRENT_PROVISION" != "" && "$CURRENT_PROVISION" != "$PROVISION" ]]; then
|
241
|
+
echo "Conflicting provisioning profiles '$PROVISION' and '$CURRENT_PROVISION' for bundle identifier '$BUNDLE_ID'." >&2
|
242
|
+
exit 1
|
243
|
+
fi
|
244
|
+
|
245
|
+
PROVISIONS_BY_ID+=("$BUNDLE_ID=$PROVISION")
|
246
|
+
}
|
247
|
+
|
248
|
+
# Add given provisioning profile to the search list
|
249
|
+
function add_provision {
|
250
|
+
|
251
|
+
local PROVISION="$1"
|
252
|
+
|
253
|
+
if [[ "$1" =~ .+=.+ ]]; then
|
254
|
+
PROVISION="${1#*=}"
|
255
|
+
add_provision_for_bundle_id "$PROVISION" "${1%%=*}"
|
256
|
+
elif [[ "$DEFAULT_PROVISION" == "" ]]; then
|
257
|
+
DEFAULT_PROVISION="$PROVISION"
|
258
|
+
fi
|
259
|
+
|
260
|
+
if [[ ! -e "$PROVISION" ]]; then
|
261
|
+
echo "Provisioning profile '$PROVISION' file does not exist" >&2
|
262
|
+
exit 1;
|
263
|
+
fi
|
264
|
+
|
265
|
+
local BUNDLE_ID=`bundle_id_for_provison "$PROVISION"`
|
266
|
+
add_provision_for_bundle_id "$PROVISION" "$BUNDLE_ID"
|
267
|
+
}
|
268
|
+
|
269
|
+
# Load bundle identifiers from provisioning profiles
|
270
|
+
for ARG in "${RAW_PROVISIONS[@]}"; do
|
271
|
+
add_provision "$ARG"
|
272
|
+
done
|
273
|
+
|
274
|
+
# Resign the given application
|
275
|
+
function resign {
|
276
|
+
|
277
|
+
local APP_PATH="$1"
|
278
|
+
local NESTED="$2"
|
279
|
+
local BUNDLE_IDENTIFIER="$BUNDLE_IDENTIFIER"
|
280
|
+
local NEW_PROVISION="$NEW_PROVISION"
|
281
|
+
local APP_IDENTIFER_PREFIX=""
|
282
|
+
local TEAM_IDENTIFIER=""
|
283
|
+
|
284
|
+
if [[ "$NESTED" == NESTED ]]; then
|
285
|
+
# Ignore bundle identifier for nested applications
|
286
|
+
BUNDLE_IDENTIFIER=""
|
287
|
+
fi
|
288
|
+
|
181
289
|
# Make sure that the Info.plist file is where we expect it
|
182
|
-
if [ ! -e "$
|
290
|
+
if [ ! -e "$APP_PATH/Info.plist" ];
|
183
291
|
then
|
184
|
-
echo "Expected file does not exist: '$
|
292
|
+
echo "Expected file does not exist: '$APP_PATH/Info.plist'" >&2
|
185
293
|
exit 1;
|
186
294
|
fi
|
187
295
|
|
188
296
|
# Read in current values from the app
|
189
|
-
CURRENT_NAME=`PlistBuddy -c "Print :CFBundleDisplayName" "$
|
190
|
-
CURRENT_BUNDLE_IDENTIFIER=`PlistBuddy -c "Print :CFBundleIdentifier" "$
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
297
|
+
local CURRENT_NAME=`PlistBuddy -c "Print :CFBundleDisplayName" "$APP_PATH/Info.plist"`
|
298
|
+
local CURRENT_BUNDLE_IDENTIFIER=`PlistBuddy -c "Print :CFBundleIdentifier" "$APP_PATH/Info.plist"`
|
299
|
+
local NEW_PROVISION=`provision_for_bundle_id "${BUNDLE_IDENTIFIER:-$CURRENT_BUNDLE_IDENTIFIER}"`
|
300
|
+
|
301
|
+
if [[ "$NEW_PROVISION" == "" && "$NESTED" != NESTED ]]; then
|
302
|
+
NEW_PROVISION="$DEFAULT_PROVISION"
|
303
|
+
fi
|
304
|
+
|
305
|
+
if [[ "$NEW_PROVISION" == "" ]]; then
|
306
|
+
if [[ "$NESTED" == NESTED ]]; then
|
307
|
+
echo "No provisioning profile for nested application: '$APP_PATH' with bundle identifier '${BUNDLE_IDENTIFIER:-$CURRENT_BUNDLE_IDENTIFIER}'" >&2
|
308
|
+
else
|
309
|
+
echo "No provisioning profile for application: '$APP_PATH' with bundle identifier '${BUNDLE_IDENTIFIER:-$CURRENT_BUNDLE_IDENTIFIER}'" >&2
|
310
|
+
fi
|
311
|
+
echo "Use the -p option (example: -p com.example.app=xxxx.mobileprovision)" >&2
|
312
|
+
exit 1;
|
313
|
+
fi
|
314
|
+
|
315
|
+
local PROVISION_BUNDLE_IDENTIFIER=`bundle_id_for_provison "$NEW_PROVISION"`
|
316
|
+
|
317
|
+
# Use provisioning profile's bundle identifier
|
318
|
+
if [ "$BUNDLE_IDENTIFIER" == "" ]; then
|
319
|
+
if [[ "$PROVISION_BUNDLE_IDENTIFIER" =~ \* ]]; then
|
195
320
|
echo "Bundle Identifier contains a *, using the current bundle identifier" >&2
|
196
|
-
BUNDLE_IDENTIFIER
|
321
|
+
BUNDLE_IDENTIFIER="$CURRENT_BUNDLE_IDENTIFIER"
|
322
|
+
else
|
323
|
+
BUNDLE_IDENTIFIER="$PROVISION_BUNDLE_IDENTIFIER"
|
197
324
|
fi
|
198
|
-
|
325
|
+
fi
|
326
|
+
|
327
|
+
if ! does_bundle_id_match "$PROVISION_BUNDLE_IDENTIFIER" "$BUNDLE_IDENTIFIER"; then
|
328
|
+
echo "Bundle Identifier '$PROVISION_BUNDLE_IDENTIFIER' in provisioning profile '$NEW_PROVISION' does not match the Bundle Identifier '$BUNDLE_IDENTIFIER' for application '$APP_PATH'." >&2
|
329
|
+
exit 1
|
199
330
|
fi
|
200
331
|
|
201
332
|
echo "Current bundle identifier is: '$CURRENT_BUNDLE_IDENTIFIER'" >&2
|
@@ -207,81 +338,69 @@ then
|
|
207
338
|
if [ "${DISPLAY_NAME}" != "${CURRENT_NAME}" ];
|
208
339
|
then
|
209
340
|
echo "Changing display name from '$CURRENT_NAME' to '$DISPLAY_NAME'" >&2
|
210
|
-
`PlistBuddy -c "Set :CFBundleDisplayName $DISPLAY_NAME" "$
|
341
|
+
`PlistBuddy -c "Set :CFBundleDisplayName $DISPLAY_NAME" "$APP_PATH/Info.plist"`
|
211
342
|
fi
|
212
343
|
fi
|
213
344
|
|
214
345
|
# Replace the embedded mobile provisioning profile
|
215
|
-
|
346
|
+
echo "Validating the new provisioning profile: $NEW_PROVISION" >&2
|
347
|
+
security cms -D -i "$NEW_PROVISION" > "$TEMP_DIR/profile.plist"
|
348
|
+
checkStatus
|
349
|
+
|
350
|
+
APP_IDENTIFER_PREFIX=`PlistBuddy -c "Print :Entitlements:application-identifier" "$TEMP_DIR/profile.plist" | grep -E '^[A-Z0-9]*' -o | tr -d '\n'`
|
351
|
+
if [ "$APP_IDENTIFER_PREFIX" == "" ];
|
216
352
|
then
|
217
|
-
|
353
|
+
APP_IDENTIFER_PREFIX=`PlistBuddy -c "Print :ApplicationIdentifierPrefix:0" "$TEMP_DIR/profile.plist"`
|
354
|
+
if [ "$APP_IDENTIFER_PREFIX" == "" ];
|
218
355
|
then
|
219
|
-
echo "
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
if [ "$APP_IDENTIFER_PREFIX" == "" ];
|
228
|
-
then
|
229
|
-
echo "Failed to extract any app identifier prefix from '$NEW_PROVISION'" >&2
|
230
|
-
exit 1;
|
231
|
-
else
|
232
|
-
echo "WARNING: extracted an app identifier prefix '$APP_IDENTIFER_PREFIX' from '$NEW_PROVISION', but it was not found in the profile's entitlements" >&2
|
233
|
-
fi
|
234
|
-
else
|
235
|
-
echo "Profile app identifier prefix is '$APP_IDENTIFER_PREFIX'" >&2
|
236
|
-
fi
|
237
|
-
|
238
|
-
TEAM_IDENTIFIER=`PlistBuddy -c "Print :Entitlements:com.apple.developer.team-identifier" "$TEMP_DIR/profile.plist" | tr -d '\n'`
|
239
|
-
if [ "$TEAM_IDENTIFIER" == "" ];
|
240
|
-
then
|
241
|
-
TEAM_IDENTIFIER=`PlistBuddy -c "Print :TeamIdentifier:0" "$TEMP_DIR/profile.plist"`
|
242
|
-
if [ "$TEAM_IDENTIFIER" == "" ];
|
243
|
-
then
|
244
|
-
echo "Failed to extract team identifier from '$NEW_PROVISION', resigned ipa may fail on iOS 8 and higher" >&2
|
245
|
-
else
|
246
|
-
echo "WARNING: extracted a team identifier '$TEAM_IDENTIFIER' from '$NEW_PROVISION', but it was not found in the profile's entitlements, resigned ipa may fail on iOS 8 and higher" >&2
|
247
|
-
fi
|
248
|
-
else
|
249
|
-
echo "Profile team identifier is '$TEAM_IDENTIFIER'" >&2
|
250
|
-
fi
|
356
|
+
echo "Failed to extract any app identifier prefix from '$NEW_PROVISION'" >&2
|
357
|
+
exit 1;
|
358
|
+
else
|
359
|
+
echo "WARNING: extracted an app identifier prefix '$APP_IDENTIFER_PREFIX' from '$NEW_PROVISION', but it was not found in the profile's entitlements" >&2
|
360
|
+
fi
|
361
|
+
else
|
362
|
+
echo "Profile app identifier prefix is '$APP_IDENTIFER_PREFIX'" >&2
|
363
|
+
fi
|
251
364
|
|
252
|
-
|
365
|
+
TEAM_IDENTIFIER=`PlistBuddy -c "Print :Entitlements:com.apple.developer.team-identifier" "$TEMP_DIR/profile.plist" | tr -d '\n'`
|
366
|
+
if [ "$TEAM_IDENTIFIER" == "" ];
|
367
|
+
then
|
368
|
+
TEAM_IDENTIFIER=`PlistBuddy -c "Print :TeamIdentifier:0" "$TEMP_DIR/profile.plist"`
|
369
|
+
if [ "$TEAM_IDENTIFIER" == "" ];
|
370
|
+
then
|
371
|
+
echo "Failed to extract team identifier from '$NEW_PROVISION', resigned ipa may fail on iOS 8 and higher" >&2
|
253
372
|
else
|
254
|
-
echo "
|
255
|
-
exit 1;
|
373
|
+
echo "WARNING: extracted a team identifier '$TEAM_IDENTIFIER' from '$NEW_PROVISION', but it was not found in the profile's entitlements, resigned ipa may fail on iOS 8 and higher" >&2
|
256
374
|
fi
|
257
375
|
else
|
258
|
-
echo "
|
259
|
-
exit 1;
|
376
|
+
echo "Profile team identifier is '$TEAM_IDENTIFIER'" >&2
|
260
377
|
fi
|
261
378
|
|
379
|
+
cp "$NEW_PROVISION" "$APP_PATH/embedded.mobileprovision"
|
380
|
+
|
262
381
|
|
263
382
|
#if the current bundle identifier is different from the new one in the provisioning profile, then change it.
|
264
383
|
if [ "$CURRENT_BUNDLE_IDENTIFIER" != "$BUNDLE_IDENTIFIER" ];
|
265
384
|
then
|
266
385
|
echo "Updating the bundle identifier from '$CURRENT_BUNDLE_IDENTIFIER' to '$BUNDLE_IDENTIFIER'" >&2
|
267
|
-
`PlistBuddy -c "Set :CFBundleIdentifier $BUNDLE_IDENTIFIER" "$
|
386
|
+
`PlistBuddy -c "Set :CFBundleIdentifier $BUNDLE_IDENTIFIER" "$APP_PATH/Info.plist"`
|
268
387
|
checkStatus
|
269
388
|
fi
|
270
389
|
|
271
390
|
# Update the version number properties in the Info.plist if a version number has been provided
|
272
391
|
if [ "$VERSION_NUMBER" != "" ];
|
273
392
|
then
|
274
|
-
CURRENT_VERSION_NUMBER=`PlistBuddy -c "Print :CFBundleVersion" "$
|
393
|
+
CURRENT_VERSION_NUMBER=`PlistBuddy -c "Print :CFBundleVersion" "$APP_PATH/Info.plist"`
|
275
394
|
if [ "$VERSION_NUMBER" != "$CURRENT_VERSION_NUMBER" ];
|
276
395
|
then
|
277
396
|
echo "Updating the version from '$CURRENT_VERSION_NUMBER' to '$VERSION_NUMBER'" >&2
|
278
|
-
`PlistBuddy -c "Set :CFBundleVersion $VERSION_NUMBER" "$
|
279
|
-
`PlistBuddy -c "Set :CFBundleShortVersionString $VERSION_NUMBER" "$
|
397
|
+
`PlistBuddy -c "Set :CFBundleVersion $VERSION_NUMBER" "$APP_PATH/Info.plist"`
|
398
|
+
`PlistBuddy -c "Set :CFBundleShortVersionString $VERSION_NUMBER" "$APP_PATH/Info.plist"`
|
280
399
|
fi
|
281
400
|
fi
|
282
401
|
|
283
402
|
# Check for and resign any embedded frameworks (new feature for iOS 8 and above apps)
|
284
|
-
FRAMEWORKS_DIR="$
|
403
|
+
FRAMEWORKS_DIR="$APP_PATH/Frameworks"
|
285
404
|
if [ -d "$FRAMEWORKS_DIR" ];
|
286
405
|
then
|
287
406
|
if [ "$TEAM_IDENTIFIER" == "" ];
|
@@ -304,7 +423,6 @@ then
|
|
304
423
|
fi
|
305
424
|
|
306
425
|
|
307
|
-
# Resign the application
|
308
426
|
if [ "$ENTITLEMENTS" != "" ];
|
309
427
|
then
|
310
428
|
if [ -n "$APP_IDENTIFER_PREFIX" ];
|
@@ -339,11 +457,11 @@ then
|
|
339
457
|
|
340
458
|
echo "Resigning application using certificate: '$CERTIFICATE'" >&2
|
341
459
|
echo "and entitlements: $ENTITLEMENTS" >&2
|
342
|
-
/usr/bin/codesign -f -s "$CERTIFICATE" --entitlements="$ENTITLEMENTS" "$
|
460
|
+
/usr/bin/codesign -f -s "$CERTIFICATE" --entitlements="$ENTITLEMENTS" "$APP_PATH"
|
343
461
|
checkStatus
|
344
462
|
else
|
345
463
|
echo "Extracting existing entitlements for updating" >&2
|
346
|
-
/usr/bin/codesign -d --entitlements - "$
|
464
|
+
/usr/bin/codesign -d --entitlements - "$APP_PATH" > "$TEMP_DIR/newEntitlements" 2> /dev/null
|
347
465
|
if [ $? -eq 0 ];
|
348
466
|
then
|
349
467
|
ENTITLEMENTS_TEMP=`cat "$TEMP_DIR/newEntitlements" | sed -E -e '1d'`
|
@@ -406,7 +524,7 @@ else
|
|
406
524
|
then
|
407
525
|
echo "and team identifier: '$TEAM_IDENTIFIER'" >&2
|
408
526
|
fi
|
409
|
-
/usr/bin/codesign -f -s "$CERTIFICATE" --entitlements="$TEMP_DIR/newEntitlements" "$
|
527
|
+
/usr/bin/codesign -f -s "$CERTIFICATE" --entitlements="$TEMP_DIR/newEntitlements" "$APP_PATH"
|
410
528
|
checkStatus
|
411
529
|
else
|
412
530
|
echo "Failed to create required intermediate file" >&2
|
@@ -416,14 +534,14 @@ else
|
|
416
534
|
echo "No entitlements found" >&2
|
417
535
|
echo "Resigning application using certificate: '$CERTIFICATE'" >&2
|
418
536
|
echo "without entitlements" >&2
|
419
|
-
/usr/bin/codesign -f -s "$CERTIFICATE" "$
|
537
|
+
/usr/bin/codesign -f -s "$CERTIFICATE" "$APP_PATH"
|
420
538
|
checkStatus
|
421
539
|
fi
|
422
540
|
else
|
423
541
|
echo "Failed to extract entitlements" >&2
|
424
542
|
echo "Resigning application using certificate: '$CERTIFICATE'" >&2
|
425
543
|
echo "without entitlements" >&2
|
426
|
-
/usr/bin/codesign -f -s "$CERTIFICATE" "$
|
544
|
+
/usr/bin/codesign -f -s "$CERTIFICATE" "$APP_PATH"
|
427
545
|
checkStatus
|
428
546
|
fi
|
429
547
|
fi
|
@@ -432,6 +550,18 @@ fi
|
|
432
550
|
rm -f "$TEMP_DIR/newEntitlements"
|
433
551
|
rm -f "$TEMP_DIR/profile.plist"
|
434
552
|
|
553
|
+
}
|
554
|
+
|
555
|
+
# Sign nested applications and app extensions
|
556
|
+
while IFS= read -d '' -r app;
|
557
|
+
do
|
558
|
+
echo "Resigning nested application: '$app'" >&2
|
559
|
+
resign "$app" NESTED
|
560
|
+
done < <(find "$TEMP_DIR/Payload/$APP_NAME" -d -mindepth 1 \( -name "*.app" -or -name "*.appex" \) -print0)
|
561
|
+
|
562
|
+
# Resign the application
|
563
|
+
resign "$TEMP_DIR/Payload/$APP_NAME"
|
564
|
+
|
435
565
|
# Repackage quietly
|
436
566
|
echo "Repackaging as $NEW_FILE" >&2
|
437
567
|
|
data/lib/sigh/resign.rb
CHANGED
@@ -5,28 +5,35 @@ module Sigh
|
|
5
5
|
class Resign
|
6
6
|
def run(options, args)
|
7
7
|
# get the command line inputs and parse those into the vars we need...
|
8
|
-
ipa, signing_identity,
|
8
|
+
ipa, signing_identity, provisioning_profiles = get_inputs(options, args)
|
9
9
|
|
10
10
|
# ... then invoke out programmatic interface with these vars
|
11
|
-
resign(ipa, signing_identity,
|
11
|
+
resign(ipa, signing_identity, provisioning_profiles)
|
12
12
|
end
|
13
13
|
|
14
|
-
def self.resign(ipa, signing_identity,
|
15
|
-
self.new.resign(ipa, signing_identity,
|
14
|
+
def self.resign(ipa, signing_identity, provisioning_profiles)
|
15
|
+
self.new.resign(ipa, signing_identity, provisioning_profiles)
|
16
16
|
end
|
17
17
|
|
18
|
-
def resign(ipa, signing_identity,
|
18
|
+
def resign(ipa, signing_identity, provisioning_profiles)
|
19
19
|
resign_path = find_resign_path
|
20
20
|
signing_identity = find_signing_identity(signing_identity)
|
21
21
|
|
22
|
+
unless provisioning_profiles.kind_of?(Enumerable)
|
23
|
+
provisioning_profiles = [provisioning_profiles]
|
24
|
+
end
|
25
|
+
|
22
26
|
# validate that we have valid values for all these params, we don't need to check signing_identity because `find_signing_identity` will only ever return a valid value
|
23
|
-
validate_params(resign_path, ipa,
|
27
|
+
validate_params(resign_path, ipa, provisioning_profiles)
|
28
|
+
|
29
|
+
provisioning_options = provisioning_profiles.map { |fst, snd| "-p #{[fst, snd].compact.join('=')}" }.join(' ')
|
24
30
|
|
25
31
|
command = [
|
26
32
|
resign_path.shellescape,
|
27
33
|
ipa.shellescape,
|
28
34
|
signing_identity.shellescape,
|
29
|
-
"-r yes
|
35
|
+
"-r yes",
|
36
|
+
provisioning_options,
|
30
37
|
ipa.shellescape
|
31
38
|
].join(' ')
|
32
39
|
|
@@ -40,7 +47,7 @@ module Sigh
|
|
40
47
|
ptn = 'Assuming Distribution Identity'
|
41
48
|
end
|
42
49
|
|
43
|
-
if output.include?(ptn)
|
50
|
+
if output.include?(ptn) && $?.to_i == 0
|
44
51
|
Helper.log.info "Successfully signed #{ipa}!".green
|
45
52
|
true
|
46
53
|
else
|
@@ -52,9 +59,9 @@ module Sigh
|
|
52
59
|
def get_inputs(options, args)
|
53
60
|
ipa = args.first || find_ipa || ask('Path to ipa file: ')
|
54
61
|
signing_identity = options.signing_identity || ask_for_signing_identity
|
55
|
-
|
62
|
+
provisioning_profiles = options.provisioning_profile || find_provisioning_profile || ask('Path to provisioning file: ')
|
56
63
|
|
57
|
-
return ipa, signing_identity,
|
64
|
+
return ipa, signing_identity, provisioning_profiles
|
58
65
|
end
|
59
66
|
|
60
67
|
def find_resign_path
|
@@ -78,10 +85,10 @@ module Sigh
|
|
78
85
|
signing_identity
|
79
86
|
end
|
80
87
|
|
81
|
-
def validate_params(resign_path, ipa,
|
88
|
+
def validate_params(resign_path, ipa, provisioning_profiles)
|
82
89
|
validate_resign_path(resign_path)
|
83
90
|
validate_ipa_file(ipa)
|
84
|
-
validate_provisioning_file(
|
91
|
+
provisioning_profiles.each { |fst, snd| validate_provisioning_file(snd || fst) }
|
85
92
|
end
|
86
93
|
|
87
94
|
def validate_resign_path(resign_path)
|
data/lib/sigh/runner.rb
CHANGED
@@ -28,7 +28,7 @@ module Sigh
|
|
28
28
|
Helper.log.info "Updating the provisioning profile".yellow
|
29
29
|
else
|
30
30
|
Helper.log.info "Updating the profile to include all devices".yellow
|
31
|
-
profile.devices = Spaceship.device.
|
31
|
+
profile.devices = Spaceship.device.all_for_profile_type(profile.type)
|
32
32
|
end
|
33
33
|
|
34
34
|
profile = profile.update! # assign it, as it's a new profile
|
data/lib/sigh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sigh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastlane_core
|
@@ -50,14 +50,14 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.12.3
|
54
54
|
type: :runtime
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
60
|
+
version: 0.12.3
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: bundler
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
226
226
|
version: '0'
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
|
-
rubygems_version: 2.4.
|
229
|
+
rubygems_version: 2.4.8
|
230
230
|
signing_key:
|
231
231
|
specification_version: 4
|
232
232
|
summary: Because you would rather spend your time building stuff than fighting provisioning
|