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`