Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: Xianwen Chen on June 26, 2010, 06:45:34 PM

Title: export PATH doesn't work
Post by: Xianwen Chen on June 26, 2010, 06: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
Title: Re: export PATH doesn't work
Post by: gerald_clark on June 26, 2010, 09:13:29 PM
Startup scripts are not parents of login, and therefore cannot modify the user's environment.
Title: Re: export PATH doesn't work
Post by: roberts on June 26, 2010, 09:49:53 PM
Might try all one line:

PATH=/usr/local/texlive/2009/bin/i386-linux:$PATH texlive-latex
Title: Re: export PATH doesn't work
Post by: Xianwen Chen on June 27, 2010, 02:35:05 AM
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
Title: Re: export PATH doesn't work
Post by: Xianwen Chen on June 27, 2010, 02:36:12 AM
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
Title: Re: export PATH doesn't work
Post by: gerald_clark on June 27, 2010, 11:53:59 AM
Set your custom PATH in your .profile
Title: Re: export PATH doesn't work
Post by: Xianwen Chen on June 27, 2010, 11: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
Title: Re: export PATH doesn't work
Post by: Jason W on June 27, 2010, 01:04:58 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.
Title: Re: export PATH doesn't work
Post by: jur on June 27, 2010, 05: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.
Title: Re: export PATH doesn't work
Post by: Jason W on June 27, 2010, 08: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.
Title: Re: export PATH doesn't work
Post by: jur on June 27, 2010, 08:47:57 PM
... so are you saying export is not intended to work in X, ie what I found was intended?
Title: Re: export PATH doesn't work
Post by: maro on June 27, 2010, 08: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.
Title: Re: export PATH doesn't work
Post by: Xianwen Chen on June 29, 2010, 09: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.

Title: Re: export PATH doesn't work
Post by: althalus on June 30, 2010, 01:38:36 AM
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.
Title: Re: export PATH doesn't work
Post by: Xianwen Chen on June 30, 2010, 06: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