-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow specifying pkg
target:
#14393
Allow specifying pkg
target:
#14393
Conversation
Currently, we always use the `/` target, but other volumes can be provided as targets, as well as special targets like `CurrentUserHomeDirectory`. See `installer -help` for more info. In particular, if installing to `CurrentUserHomeDirectory` it seems reasonable to assume we wouldn't need `sudo`.
fc8ca1f
to
e325dc6
Compare
|
||
pkg "MyFancyPkg/Fancy.pkg", target: "CurrentUserHomeDirectory" | ||
|
||
uninstall pkgutil: "my.fancy.package" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I copied both these fixtures from the with-installable
fixture, but I simplified the uninstall
stanza, since all the extra stuff there isn't relevant to the specs these are used in.
"-target", "CurrentUserHomeDirectory"], | ||
sudo: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm making an assumption here, but I feel like it's reasonable. If we're installing in the home directory, isn't it an error if sudo
is required?
Trying this out with the cask in Homebrew/homebrew-cask#139807, it looks like |
@@ -65,7 +65,8 @@ def run_installer(command: nil, verbose: false, **_options) | |||
"USER" => User.current, | |||
"USERNAME" => User.current, | |||
} | |||
command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true, env: env) | |||
sudo = target != "CurrentUserHomeDirectory" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we expect the cask to pass paths as strings, but special values like CurrentUserHomeDirectory
as a Symbol
?
sudo = target != "CurrentUserHomeDirectory" | |
sudo = target != :CurrentUserHomeDirectory |
@sambostock One thing to consider here is that the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good but from a product perspective I'd like to have discussion in https://github.com/Homebrew/homebrew-cask/pull/139807/files#r1084060179 before we merge this.
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@Homebrew/cask thoughts here? |
I agree with this comment: Homebrew/homebrew-cask#139807 (comment) Also, we have two other Casks (that I can think of) that use a |
It’s been too many years to recall exactly, but I think using a target with PKG was considered and dropped way back when. The vast majority of PKGs work by writing to specific locations, which in turn makes developers only write their PKGs that way. PKGs are relatively niche and awkward to support programatically, customising their installation options is nicher still. Unless extensive testing has been done in all available casks, this might be one of those features that will take more effort to support and work around than it’s worth. At the very least we’d need an option to say “this target cannot be customised” and in the case of PKGs I wouldn’t be surprised it that ended up applying to most of them. I’d be wary of adding the feature without a very clear “this is experimental and may be removed at any point” warning. Because it will likely see little use, it would have to be present for a good while or someone would have to test the most popular PKG casks. |
Thanks all. Given the above: passing on this, sorry. |
One such target is
CurrentUserHomeDirectory
. Seeinstaller -help
.Required for Homebrew/homebrew-cask#139807
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?