Skip to content

Instantly share code, notes, and snippets.

@jfro
Created October 20, 2011 22:39
Show Gist options
  • Save jfro/1302608 to your computer and use it in GitHub Desktop.
Save jfro/1302608 to your computer and use it in GitHub Desktop.
Re-sign frameworks in a bundle
#!/usr/bin/ruby
require 'find'
require 'fileutils'
require 'getoptlong'
if ARGV.length < 2
puts "Usage: ruby re-sign-frameworks.rb bundle signer"
exit
end
problem = false
productPath = ARGV.shift
identity = ARGV.shift
Find.find(productPath) do |path|
if not File.exists? path
puts "No such file #{path}"
problem = true
break
end
if path[-10..-1] == '.framework'
versions = Dir.glob(path+"/Versions/*")
for version in versions
if File.basename(version) != 'Current'
puts 'Re-signing: ' + version
%x{codesign -f -s "#{identity}" #{version}}
end
end
end
end
if problem
exit(1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment