Merge pull request #4866 from amyspark/quarantine-support-unknown
Cask: constrain quarantine support status
This commit is contained in:
commit
2635160916
@ -120,9 +120,7 @@ module Cask
|
|||||||
def check_quarantine_support
|
def check_quarantine_support
|
||||||
ohai "Gatekeeper support"
|
ohai "Gatekeeper support"
|
||||||
|
|
||||||
status = Quarantine.check_quarantine_support
|
case Quarantine.check_quarantine_support
|
||||||
|
|
||||||
case status
|
|
||||||
when :quarantine_available
|
when :quarantine_available
|
||||||
puts "Enabled"
|
puts "Enabled"
|
||||||
when :no_swift
|
when :no_swift
|
||||||
|
|||||||
@ -17,18 +17,24 @@ module Cask
|
|||||||
|
|
||||||
if swift.nil?
|
if swift.nil?
|
||||||
odebug "Swift is not available on this system."
|
odebug "Swift is not available on this system."
|
||||||
return :no_swift
|
:no_swift
|
||||||
|
else
|
||||||
|
api_check = system_command(swift,
|
||||||
|
args: [QUARANTINE_SCRIPT],
|
||||||
|
print_stderr: false)
|
||||||
|
|
||||||
|
case api_check.exit_status
|
||||||
|
when 5
|
||||||
|
odebug "This feature requires the macOS 10.10 SDK or higher."
|
||||||
|
:no_quarantine
|
||||||
|
when 2
|
||||||
|
odebug "Quarantine is available."
|
||||||
|
:quarantine_available
|
||||||
|
else
|
||||||
|
odebug "Unknown support status"
|
||||||
|
:unknown
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
api_check = system_command(swift, args: [QUARANTINE_SCRIPT])
|
|
||||||
|
|
||||||
if api_check.exit_status == 5
|
|
||||||
odebug "This feature requires the macOS 10.10 SDK or higher."
|
|
||||||
return :no_quarantine
|
|
||||||
end
|
|
||||||
|
|
||||||
odebug "Quarantine is available."
|
|
||||||
:quarantine_available
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def available?
|
def available?
|
||||||
@ -73,12 +79,12 @@ module Cask
|
|||||||
odebug "Releasing #{download_path} from quarantine"
|
odebug "Releasing #{download_path} from quarantine"
|
||||||
|
|
||||||
quarantiner = system_command("/usr/bin/xattr",
|
quarantiner = system_command("/usr/bin/xattr",
|
||||||
args: [
|
args: [
|
||||||
"-d",
|
"-d",
|
||||||
QUARANTINE_ATTRIBUTE,
|
QUARANTINE_ATTRIBUTE,
|
||||||
download_path,
|
download_path,
|
||||||
],
|
],
|
||||||
print_stderr: false)
|
print_stderr: false)
|
||||||
|
|
||||||
return if quarantiner.success?
|
return if quarantiner.success?
|
||||||
|
|
||||||
@ -93,12 +99,13 @@ module Cask
|
|||||||
odebug "Quarantining #{download_path}"
|
odebug "Quarantining #{download_path}"
|
||||||
|
|
||||||
quarantiner = system_command(swift,
|
quarantiner = system_command(swift,
|
||||||
args: [
|
args: [
|
||||||
QUARANTINE_SCRIPT,
|
QUARANTINE_SCRIPT,
|
||||||
download_path,
|
download_path,
|
||||||
cask.url.to_s,
|
cask.url.to_s,
|
||||||
cask.homepage.to_s,
|
cask.homepage.to_s,
|
||||||
])
|
],
|
||||||
|
print_stderr: false)
|
||||||
|
|
||||||
return if quarantiner.success?
|
return if quarantiner.success?
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user