Merge pull request #19126 from Kentzo/cask-relocate-sudo

sudo: Elevate priviliges before adding metadata after relocating a ca…
This commit is contained in:
Mike McQuaid 2025-01-21 08:44:57 +00:00 committed by GitHub
commit 0c44ff0785
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,11 +89,14 @@ module Cask
altnames = "(#{altnames})"
# Some packages are shipped as u=rx (e.g. Bitcoin Core)
command.run!("/bin/chmod", args: ["--", "u+rw", file, file.realpath])
command.run!("/bin/chmod",
args: ["--", "u+rw", file, file.realpath],
sudo: !file.writable? || !file.realpath.writable?)
command.run!("/usr/bin/xattr",
args: ["-w", ALT_NAME_ATTRIBUTE, altnames, file],
print_stderr: false)
print_stderr: false,
sudo: !file.writable?)
end
def printable_target