-
- Downloads
Fix PKG installer environment
This commit solves an issue where the environment handed to `/usr/sbin/installer` is not the same as the environment used by the graphical PKG installer. This is evident in some post-install scripts, e. g. the `component-10.pkg/Scripts/postinstall` script in the `dymo-label` cask. The code says: ``` USER_ID=`id -u ${USER}` launchctl bootstrap gui/$USER_ID /Library/LaunchAgents/com.dymo.dls.webservice.plist ``` The graphical installer will export e. g. `USER=alice`, and everything works as intended. However, `brew cask install` does not override `sudo`’s default, which is `USER=ROOT`. This violates the assumptions in the script. This commit fixes the issue by configuring `sudo` to override the following environment variables with the proper user name: - `LOGNAME` - `USER` - `USERNAME`
Showing
- Library/Homebrew/cask/lib/hbc/artifact/pkg.rb 7 additions, 1 deletionLibrary/Homebrew/cask/lib/hbc/artifact/pkg.rb
- Library/Homebrew/cask/lib/hbc/system_command.rb 17 additions, 5 deletionsLibrary/Homebrew/cask/lib/hbc/system_command.rb
- Library/Homebrew/test/cask/artifact/pkg_spec.rb 10 additions, 0 deletionsLibrary/Homebrew/test/cask/artifact/pkg_spec.rb
- Library/Homebrew/test/cask/system_command_spec.rb 62 additions, 0 deletionsLibrary/Homebrew/test/cask/system_command_spec.rb
- Library/Homebrew/test/support/helper/cask/fake_system_command.rb 1 addition, 1 deletion.../Homebrew/test/support/helper/cask/fake_system_command.rb
- Library/Homebrew/test/support/helper/spec/shared_examples/hbc_staged.rb 3 additions, 3 deletions...ew/test/support/helper/spec/shared_examples/hbc_staged.rb
Please register or sign in to comment