LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Linux Environment variables (https://www.linuxquestions.org/questions/linux-software-2/linux-environment-variables-269848/)

gugamare 12-24-2004 03:26 AM

Linux Environment variables
 
Hello guys,

I'm currently creating an RPM package for a device driver and I 'm having difficulty finding documentation which contains a list of standard Linux environment variables that I can use in the spec file. This presents a problem because I'm currently pointing to specific directories in my box (for example the kernel source path), which will be different depending on what version of the Kernel and etc that the end-user has. Any one know where I can find this stuff?

Also, how does linux handle environment variables? What files do I have to modify to include a directory in the PATH, etc...

Thanks in advance, you guys have always been great.

/bin/bash 12-24-2004 04:09 AM

Most of the variables you would be concerned with would be shell variables. You will find a long list of shell variables in man bash.

Of course each program may have its own set of variables. For instance it's common to have these variables:
JAVA_HOME=/usr/lib/java
KDEDIR=/opt/kde

To modify the path you would do something like this:
export PATH=${PATH}:/MyDirectory
You can change this for all users by putting it in /etc/profile or just a specific user by editing ~/.bashrc

gugamare 12-24-2004 08:18 AM

Those are good tips /bin/bash, thanks. But I still can't find a variable or a command to discover the kernel version, or the path to the kernel source of the user.

megaspaz 12-24-2004 10:25 AM

uname -r will give you the running kernel version.

for the kernel source, mine's in /usr/src where there's a directory called linux-2.X.XXXX-X. basically look in /usr/src.

the file that i use to add to the path variable is /etc/profile as it allows for the path to be seen globally for all users. after saving changes, you can load those variables with the 'source /etc/profile' command.

/bin/bash 12-31-2004 04:27 AM

Most config files will set the path to the kernel sources to the default /usr/src/linux, and of course if there are no sources there you get an error. If you put your kernel sources somewhere else just make a symlink /usr/src/linux that points to your sources. e.g.
/usr/src/linux -> /home/user/linux-2.6.10

gugamare 12-31-2004 11:19 AM

It works, thanks


All times are GMT -5. The time now is 05:11 PM.