You are not logged in.

#1 2010-09-24 23:44:10

plmday
Member
From: Germany
Registered: 2009-02-19
Posts: 66

[SOLVED] Altering PATH after package installation

I am preparing a PKGBUILD file for an app. Since it installs files into non-standard directory, I have to make it install to /opt/app/. I have done the PKGBUILD file, but I have no idea how to achieve this effect: after installation, the working user can immediately invoke the app from command line, in other words, I wanna the app immediately under the user's search path. I tried put an "export PATH=$PATH:/opt/app/bin" in post_install(), but it seems not work. Any idea?

Last edited by plmday (2010-09-25 14:37:41)


Arch, the Portal of Linux

Offline

#2 2010-09-25 08:30:41

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: [SOLVED] Altering PATH after package installation

Environment variables can only be exported to child processes. There is no way to alter the environment of parent processes.

If you want immediate availability, add a launcher script and put that into /usr/bin.

But why would you want this, anyway? I'd prefer you'd rather do nothing and trust the user to figure it out. pacman -Ql isn't that hard, really.

Offline

#3 2010-09-25 08:35:07

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: [SOLVED] Altering PATH after package installation

hbekel wrote:

But why would you want this, anyway? I'd prefer you'd rather do nothing and trust the user to figure it out. pacman -Ql isn't that hard, really.

I'm not sure if it's the Arch way, but you can put it in the install script:
http://wiki.archlinux.org/index.php/PKGBUILD

It may set the PATH or only echo some message to inform the user of some actions that need to be taken: http://aur.archlinux.org/packages/pkgto … ls.install

Last edited by karol (2010-09-25 08:40:06)

Offline

#4 2010-09-25 09:32:02

hbekel
Member
Registered: 2008-10-04
Posts: 311

Re: [SOLVED] Altering PATH after package installation

karol wrote:

I'm not sure if it's the Arch way, but you can put it in the install script:
http://wiki.archlinux.org/index.php/PKGBUILD

It may set the PATH or only echo some message to inform the user of some actions that need to be taken: http://aur.archlinux.org/packages/pkgto … ls.install

It's not even the Unix way. Again, export is a one way street. Exporting PATH in a child process will not magically alter PATH in the parent process.

If a package needs env vars to be set, a script in /etc/profile.d is the right way to do it.

Offline

#5 2010-09-25 14:37:10

plmday
Member
From: Germany
Registered: 2009-02-19
Posts: 66

Re: [SOLVED] Altering PATH after package installation

Thanks for the help, guys. I do both.


Arch, the Portal of Linux

Offline

Board footer

Powered by FluxBB