Skip to content

Commit

Permalink
Verify code-signature after installation.
Browse files Browse the repository at this point in the history
  • Loading branch information
neonichu committed Sep 21, 2015
1 parent 39b36ec commit a583ad9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/xcode/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def install_dmg(dmgPath, suffix = '', switch = true, clean = true, components =
`sudo ditto "#{source}" "#{xcode_path}"`
`umount "/Volumes/Xcode"`

if not verify_integrity(xcode_path)
`sudo rm -f #{xcode_path}`
end

enable_developer_mode
`sudo xcodebuild -license` unless xcode_license_approved?
install_components(xcode_path) if components
Expand Down Expand Up @@ -240,6 +244,11 @@ def seedlist
xcodes || fetch_seedlist
end

def verify_integrity(path)
puts `codesign --verify --verbose #{path}`
$?.exitstatus == 0
end

def xcode_license_approved?
!(`/usr/bin/xcrun clang 2>&1` =~ /license/ && !$CHILD_STATUS.success?)
end
Expand Down

1 comment on commit a583ad9

@jpsim
Copy link
Collaborator

@jpsim jpsim commented on a583ad9 Sep 22, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 how timely 😉

Please sign in to comment.