packagesdev / packages

Integrated Packaging Environment for OS X
312 stars 44 forks source link

Access to $PATH during post install script #136

Open VicenteCantonPaterna opened 1 year ago

VicenteCantonPaterna commented 1 year ago

First of all, thank you very much for the amazing tool you have made. I would like to know if is it possible to access the user's $PATH variable while running the postinstall script. I am trying to copy the $PATH into a plist file so that it has access to some installed commands, but after installation the copied $PATH is empty (or it does not contain same values as when I run $PATH in a terminal).

I checked the docs and I see some env variables available like INSTALL_PKG_SESSION_ID, but I could not find anything about $PATH. Is it available under some other name? If not, would it be possible to access it somehow? Thanks!

Edit: this is what gets pasted running echo $PATH >> file inside the script:

/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec

packagesdev commented 1 year ago

It's not possible as far as I know as the script is run in an environment that is not the one of the current user (if the package does not request admin authentication) or the super user (if the package requires admin authentication).

For the record, it's strongly recommended to use absolute paths for commands run from a pre- or post- installations script.