Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 01 Sep 2014, 19:35
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
"env" variable problem? [ Solved ]
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 3 [37 Posts]   Goto page: 1, 2, 3 Next
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Sat 16 Jun 2012, 21:36    Post subject:  "env" variable problem? [ Solved ]  

I`ve made env variables before, no problem.

Create /etc/profile.local and add the line:
Code:
PATH=$PATH:/root/my-applications/sbin
export PATH

Works great.

Then right below it I have:
Code:
APP_DIR=$(</etc/AppDir.conf)
export APP_DIR

The file does exist.
I know I can export them both in one statement.

The variable survives all the way to the /root/Startup dir.
I put a xmessage there and it shows that $APP_DIR is still alive.

But in rxvt, neither "set" or "env" show the variable.
And typing in rxvt:
Code:
sh-4.1# echo $APP_DIR

sh-4.1#


Why is it that rxvt doesn`t get my variable?
And exactly where or what does have it?

As said, I`ve made them before no trouble, but now in Lucid-528-005 no go.

Last edited by sunburnt on Mon 18 Jun 2012, 07:35; edited 1 time in total
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 17 Jun 2012, 04:35    Post subject:  

maybe you need "export $APP_DIR" ??
Last edited by jpeps on Sun 17 Jun 2012, 04:44; edited 1 time in total
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sun 17 Jun 2012, 04:44    Post subject:  

I found out that Variables that have to be visible in Xorg environment, really have to be exported by the /usr/bin/xwin script .

Normally it should be enought as xwin is started normally by /etc/profile . This is a problematic feature, because it relays on the non-existance of /tmp/bootcount.txt file, which actually is a .touch file .

It should go to /var/Puppy/X or /var/Puppy/tmp or /var/puppy/state in my thoughts .

If you logout from X and type xwin again, i could think of that some exports don't work anymore .
I am also not sure about fido or spot . .

I launch xwin from /etc/inittab with :once:/usr/bin/xwin and then i have no /etc/profile parsing before . I do it with "#!/bin/bash --login" bang in xwin script .

Daemons like acpid are another thing . If they should popup an xmessage, i found out that i had to start them from ~/.xinitrc .
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Sun 17 Jun 2012, 06:20    Post subject:  

jpeps; I`m sure it`s "export (variable)"... No $.
As I said, the PATH export works fine, but the identical APP_DIR doesn`t.

The script in /root/Startup shows APP_DIR is good there, but not in rxvt.


Karl; Yikes! The more I learn, the more I see what a mixed bag Linux really is.
Standards... Does anyone know what standards are? Confused

I just don`t see why PATH is okay and APP_DIR is not.
I`ll try exporting it in xwin just before the "start X" section.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sun 17 Jun 2012, 06:28    Post subject:  

Quote:
Karl; Yikes! The more I learn, the more I see what a mixed bag Linux really is.


Thierry : Thats for sure ! Am on win atm to fix Puppy Laughing
Back to top
View user's profile Send private message Visit poster's website 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Sun 17 Jun 2012, 06:46    Post subject:  

Update: Nope, it didn`t work. I kinda figured it wouldn`t.

Karl; How about making a new Linux distro? Rather than reworking the wheel?

A much simpler one, with no union, no legacy of scattered install files, etc.

I have a modded version of Tiny Core that`s very close to what I have in mind.
Main dirs. are divided into read-only that`re in a Sq. file, read-write on a partition,
and the system dirs. are just as they are in the initrdfs ( mnt, proc, sys, tmp, ...).
I have a dir. tree map that shows what is what.
Most of the main dirs. are links, this allows the O.S. to be rearranged.

### If there`s any interest I`ll post a prospectus about it..


### News... I have my AppDir setup working, I modded it to allow multiple apps.
And I also modded it to work with shared libs. in squash files.
This allows the apps. to load into ram and not have multiple copies of libs.
In many cases I`ve seen, the libs. are much bigger than the app. itself.

I have an AppDir builder script that works okay, more work`s needed.
I have Audacious, mtPaint, Xfe filer, and xMahjongg all working.
As I get more apps. I`ll post the selection and gather more.
Back to top
View user's profile Send private message 
Karl Godt


Joined: 20 Jun 2010
Posts: 3964
Location: Kiel,Germany

PostPosted: Sun 17 Jun 2012, 08:04    Post subject:  

Have no idea about Tiny Core .

Could you post a link to an .iso for dualcore pcs (dell optiplex 755,4 GB Ram) ?

Would it be
Live cd only, with mounted /tmp always on PUPMODE 2 ?

Interesting idea .

Some use T2 to build Puppy, some use Puppy to build DTLinux .
Back to top
View user's profile Send private message Visit poster's website 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Sun 17 Jun 2012, 11:20    Post subject:  

I tried this in .bashrc and it worked

Code:

Apps_Dir='/mnt/sda2/Desktop/apps_dir'
set - $Apps_Dir
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2238

PostPosted: Sun 17 Jun 2012, 12:43    Post subject:  

I think your problem is here:
Code:

APP_DIR=$(</etc/AppDir.conf)

Are you trying to read the file? Is all the code being run with bash or is another shell involved? The above construct will not work with all shells. Try using:
Code:
APP_DIR="`cat /etc/AppDir.conf`"
[/code]
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11092
Location: The Peoples Republic of California

PostPosted: Sun 17 Jun 2012, 20:18    Post subject:  

sunburnt wrote:
I just don`t see why PATH is okay and APP_DIR is not.


I don't see why PATH works at all. I thought /etc/rc.local runs before /etc/profile. If so, the PATH statement in profile would not append a previous PATH statement. It would replace it with the new PATH statement.

Curiously

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
sunburnt


Joined: 08 Jun 2005
Posts: 5016
Location: Arizona, U.S.A.

PostPosted: Sun 17 Jun 2012, 21:41    Post subject:  

jpeps; I posted to you, but it didn`t show up here... Odd.! Nope, it didn`t work either.

I wonder why set shows different variables then env does?

Hi amigo; I tried: APP_DIR='/mnt/sdb3/AppLib'
That`s the value in the config. file, still no go when rxvt is run.

Bruce B;
Barry made comment somewhere that the environment variables seem to die at some point in the boot process.


The thing that`s interesting is that one gets through and the other one only makes it to the /etc/Startup folder.

In /etc/Startup I made a script:
Code:
xmessage " Test" ". $APP_DIR ."


It shows that the variable is alive and well, then run the same script file in rxvt and the xMessageBox is empty.
.
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11092
Location: The Peoples Republic of California

PostPosted: Sun 17 Jun 2012, 23:32    Post subject:  

sunburnt wrote:
jpeps; I posted to you, but it didn`t show up here... Odd.! Nope, it didn`t work either.

I wonder why set shows different variables then env does?

Hi amigo; I tried: APP_DIR='/mnt/sdb3/AppLib'
That`s the value in the config. file, still no go when rxvt is run.

Bruce B;
Barry made comment somewhere that the environment variables seem to die at some point in the boot process.


The thing that`s interesting is that one gets through and the other one only makes it to the /etc/Startup folder.

In /etc/Startup I made a script:
Code:
xmessage " Test" ". $APP_DIR ."


It shows that the variable is alive and well, then run the same script file in rxvt and the xMessageBox is empty.
.


rxvt is an emulator. If bash is the shell one of the first things it does in Puppy is source ~/.bashrc

You can put source commands to a file containing the instructions to reset the variables that were lost.

This file must be sourced and not in a secondary shell or the env will be lost.

It is a workaround for a problem you have which I cannot explain.

Example:

. /root/.extracommands




~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Mon 18 Jun 2012, 00:22    Post subject:  

Check what shell you're using: "ps | grep $$"
Back to top
View user's profile Send private message 
Bruce B


Joined: 18 May 2005
Posts: 11092
Location: The Peoples Republic of California

PostPosted: Mon 18 Jun 2012, 01:03    Post subject:  

sunburnt wrote:
I wonder why set shows different variables then env does?


set as I know it is an internal bash command. It might behave completely in other shells.

type: help set

env is an external command

type: env --help

~

_________________
New! Puppy Linux Links Page
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Mon 18 Jun 2012, 01:40    Post subject:  

Also works: Place a file in /etc/profile.d with desired variables:

ex: /etc/profile.d/MyEnv

APPS_DIR="/mnt/sda2/Desktop/apps_dir"
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 3 [37 Posts]   Goto page: 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0957s ][ Queries: 12 (0.0187s) ][ GZIP on ]