WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: export PATH doesn't work  (Read 5727 times)

Offline Xianwen Chen

  • Full Member
  • ***
  • Posts: 142
export PATH doesn't work
« on: June 26, 2010, 03:45:34 PM »
Dear TCLers,

I'm making texlive-latex 2009 package for TCL. A start up script "texlive-latex" is packed inside the squashfs file, at usr/local/tce.installed:

Code: [Select]
PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH
export PATH

However, it doesn't work at all. I'm running 2.11.5. Some hints please?

Best regards,

Xianwen
« Last Edit: June 26, 2010, 03:49:32 PM by Xianwen Chen »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: export PATH doesn't work
« Reply #1 on: June 26, 2010, 06:13:29 PM »
Startup scripts are not parents of login, and therefore cannot modify the user's environment.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: export PATH doesn't work
« Reply #2 on: June 26, 2010, 06:49:53 PM »
Might try all one line:

PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH texlive-latex
10+ Years Contributing to Linux Open Source Projects.

Offline Xianwen Chen

  • Full Member
  • ***
  • Posts: 142
Re: export PATH doesn't work
« Reply #3 on: June 26, 2010, 11:35:05 PM »
Startup scripts are not parents of login, and therefore cannot modify the user's environment.

Dear gerald_clark,

Thanks for your hint. I'm confused. How could I modify user's environment then?

Best regards,

Xianwen

Offline Xianwen Chen

  • Full Member
  • ***
  • Posts: 142
Re: export PATH doesn't work
« Reply #4 on: June 26, 2010, 11:36:12 PM »
Might try all one line:

PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH texlive-latex

Dear Robert,

Thanks for your suggestion! However, it doesn't work. This problem has puzzled me for weeks.  ???

Best regards,

Xianwen

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: export PATH doesn't work
« Reply #5 on: June 27, 2010, 08:53:59 AM »
Set your custom PATH in your .profile

Offline Xianwen Chen

  • Full Member
  • ***
  • Posts: 142
Re: export PATH doesn't work
« Reply #6 on: June 27, 2010, 08:55:50 AM »
Set your custom PATH in your .profile

Hi gerald_clark,

Thanks a lot for your advice!

That is actually why I'm holding this extension. I don't want to ask every user of this extension to add a line to their .profile or .ashrc.

Best regards,

Xianwen

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: export PATH doesn't work
« Reply #7 on: June 27, 2010, 10:04:58 AM »
Have you created a wrapper for texlive-latex?  Rename the binary texlive-latex-bin and create a wrapper script named /usr/local/bin/texlive-latex similar to this:

Code: [Select]
#!/bin/sh

PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH
export PATH

/usr/local/texlive/2009/bin/i386-linux/texlive-latex-bin ##(assuming that is the location.)


But if using


PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH  /path/to/texlive-latex

from the command line does not work, then the wrapper probably wouldn't work either.
« Last Edit: June 27, 2010, 11:16:10 AM by Jason W »

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: export PATH doesn't work
« Reply #8 on: June 27, 2010, 02:48:33 PM »
I wonder if it could the the export statement which is buggy?

I followed a scripting tutorial a while ago, and one of the statements treated was export. I found I could not get export to do what the tut was saying it should - I could not make it stick outside a terminal window. The only place where it is working for me is in .profile.

Offline Jason W

  • Administrator
  • Hero Member
  • *****
  • Posts: 9730
Re: export PATH doesn't work
« Reply #9 on: June 27, 2010, 05:17:19 PM »
Support for scripts that can set environment variables was added to /etc/profile as was brought up here:

http://forum.tinycorelinux.net/index.php?topic=5086.0

If a script is there during login, it is run and that could export variables when logging in.  But that does not cover an extension that is loaded after boot that could have a /etc/profile.d/ script to set variables like a texlive extension would need.

Could we consider adding a similar routine to .ashrc (I think that would be the right place?) so extensions can set variables if they are loaded after login?  

That is, if it would not cause a duplication of what is already done in /etc/profile and result in duplicated variables.
« Last Edit: June 27, 2010, 05:30:59 PM by Jason W »

Offline jur

  • Hero Member
  • *****
  • Posts: 863
    • cycling photo essays
Re: export PATH doesn't work
« Reply #10 on: June 27, 2010, 05:47:57 PM »
... so are you saying export is not intended to work in X, ie what I found was intended?

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: export PATH doesn't work
« Reply #11 on: June 27, 2010, 05:53:47 PM »
jur: I think the point is in which shell the export gets executed and to which degree child processes are inheriting the context.

Offline Xianwen Chen

  • Full Member
  • ***
  • Posts: 142
Re: export PATH doesn't work
« Reply #12 on: June 29, 2010, 06:11:08 PM »
Have you created a wrapper for texlive-latex?  Rename the binary texlive-latex-bin and create a wrapper script named /usr/local/bin/texlive-latex similar to this:

Code: [Select]
#!/bin/sh

PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH
export PATH

/usr/local/texlive/2009/bin/i386-linux/texlive-latex-bin ##(assuming that is the location.)


But if using


PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH  /path/to/texlive-latex

from the command line does not work, then the wrapper probably wouldn't work either.

Hi Jason,

Thanks a lot! However, it doesn't work, because the system wide $PATH will be searched before the user $PATH. Hence, the wrapped script will be executed all the time. It would be okay for most of the cases, but not for texlive. Anyway, I think using a live-cd will be an ideal way of doing it. I'll put this aside and work on other packages.


Offline althalus

  • Sr. Member
  • ****
  • Posts: 351
Re: export PATH doesn't work
« Reply #13 on: June 29, 2010, 10:38:36 PM »
Hi Jason,

Thanks a lot! However, it doesn't work, because the system wide $PATH will be searched before the user $PATH. Hence, the wrapped script will be executed all the time. It would be okay for most of the cases, but not for texlive. Anyway, I think using a live-cd will be an ideal way of doing it. I'll put this aside and work on other packages.



Have you actually tried the solution put forward by Jason? I've used a similar solution a number of times for similar purposes myself, and it's typically quite effective for this sort of use-case.

Offline Xianwen Chen

  • Full Member
  • ***
  • Posts: 142
Re: export PATH doesn't work
« Reply #14 on: June 30, 2010, 03:57:35 AM »


Have you actually tried the solution put forward by Jason? I've used a similar solution a number of times for similar purposes myself, and it's typically quite effective for this sort of use-case.

Hi althalus,

Yes I have. It didn't work for texlive.

Best regards,

Xianwen