bin/briar_resign.rb in briar-1.1.3 vs bin/briar_resign.rb in briar-1.1.4
- old
+ new
@@ -11,13 +11,13 @@
block.call
puts '-'*10 + '-------' + '-'*10 + "\n"
end
def briar_resign(args)
- if args.length != 4
+ if args.length < 4
msg('Usage') do
- puts 'briar resign </path/to/your.ipa> </path/to/your.mobileprovision> <wildcard-prefix> <signing-identity>'
+ puts 'briar resign </path/to/your.ipa> </path/to/your.mobileprovision> <wildcard-prefix> <signing-identity> <optional-application-id>'
end
exit 1
end
ipa = args[0]
@@ -68,15 +68,23 @@
signing_id = args[3]
msg ('Info') do
puts "will resign with identity '#{signing_id}'"
end
- resign_ipa({:ipa => ipa,
- :provision => mobile_prov,
- :id => signing_id,
- :wildcard => wildcard})
+ options = {:ipa => ipa,
+ :provision => mobile_prov,
+ :id => signing_id,
+ :wildcard => wildcard}
+ if args.length == 5
+ app_id = args[4]
+ puts "INFO: will resign with a new application id '#{app_id}'"
+ options[:app_id] = app_id
+ end
+
+ resign_ipa(options)
+
end
def resign_ipa(options)
work_dir = 'resigned'
ipa = File.join(work_dir, File.basename(options[:ipa]))
@@ -172,22 +180,29 @@
end
end
puts "INFO: parsed plist at '#{info_plist_path}'"
- app_id = data['CFBundleIdentifier']
-
+ app_id = options[:app_id] ? options[:app_id] : data['CFBundleIdentifier']
unless app_id
msg 'error' do
puts "Unable to find CFBundleIdentifier in plist '#{data}'"
end
exit 1
end
puts "INFO: found bundle identifier '#{app_id}'"
+ # Save changes to plist
+ unless data['CFBundleIdentifier'] == app_id
+ puts "INFO: saving the new bundle identifier '#{app_id}' to plist file"
+ data['CFBundleIdentifier'] = app_id
+ plist.value = CFPropertyList.guess(data)
+ plist.save(info_plist_path, CFPropertyList::List::FORMAT_XML)
+ end
+
bundle_exec = data['CFBundleExecutable']
unless bundle_exec
msg 'error' do
puts "unable to find CFBundleExecutable in plist '#{data}'"
@@ -265,10 +280,12 @@
end
puts "INFO: finished signing '#{ipa}'"
- system("open #{work_dir}")
+ unless ENV['BRIAR_DONT_OPEN_ON_RESIGN']
+ system("open #{work_dir}")
+ end
end