packages icon indicating copy to clipboard operation
packages copied to clipboard

Access to $PATH during post install script

Open VicenteCantonPaterna opened this issue 2 years ago • 1 comments

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

VicenteCantonPaterna avatar Mar 15 '23 17:03 VicenteCantonPaterna

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.

packagesdev avatar Mar 17 '23 22:03 packagesdev