Quarantine is available ONLY if the script exits with '2'.
It is definitely NOT available if Swift doesn't exist or if
it exits with '5' (incompatible SDK). All other cases are
from now on treated as unsupported.
Also print to standard error only when explictly required (via an
exception).
Gatekeeper's Path Randomization is currently making automated
installation a nightmare. Let's manually toggle the (undocumented) app
translocation bit in the `com.apple.quarantine` extended attribute.
While we're at it, let's also toss in some fixes:
- zip downloads with improper permissions that prevent us from
quarantining
- quarantine/release/skip downloads as requested by the user
- In some cases (usually old CLT versions) Swift is available but needs an
extra guard to use the quarantine API.
- xattr's native filesystem recursion is an Apple extension which is
not available in Mojave; so let's use xargs.
- Insert a quarantine support check in brew cask doctor.
FixesHomebrew/homebrew-cask#51554, and fixesHomebrew/homebrew-cask#51538.