Mailinglist Archive: opensuse (714 mails)

< Previous Next >
Re: [opensuse] where can I change $PATH
On 10/2/2011 12:39 AM, Andreas wrote:

I've got an application installed from OpenSuse's repository which is in
Recently I installed a newer version as binary in /opt.

Now I'd like to remove the bin-directory of the older version and
replace it with the newer version under /opt.
I know I could add the newer bin to $PATH in /etc/bash.bashrc.local but
I rather like to remove the old one.
I'd like to keep the old binary at least for now so it's no solution to
delete the package and let YaST clean up $PATH.

Is there a central cfg-file where $PATH is defined?

You don't want to remove any of the stock directories from PATH.

1st - search for a properly packaged newer version of the app at Install that rpm and it takes care of everything.

Failing that, it's messy and not advised, but

Install your new local-self-compiled to /usr/local/bin by using the apps ./configure --prefix=/usr/local ; make install

Then remove the old app with "zypper rm appname".

From what little you've said, so far there is not enough justification to mess with PATH. There is no single place PATH is defined. It is defined differently in different contexts (init, root vs not root, ssh remote exec, ssh login, local console login, X, cgi, cron, ...) and in most of those contexts it is defined by a several step process of setting some value initially and then having parts appended, prepended or wholesale replaced.

You could put the new app in /opt/newapp/bin
and put
in /etc/profile.local

That will affect all subsequent interactive logins, and nothing else, not cron jobs, not initrc scripts, not cgi's etc. The file either doesn't exist or is empty at first, you just create it and put that line in. /etc/profile (which you should not edit) already tries to source /etc/profile.local near the end. /etc/profile only gets read at login-time though. That will put the newapp bin in ahead of all other PATH so it doesn't matter if the old version stays installed.
This is really not a great idea though. PATH can be a security concern. If you didn't have closed permissions on the new bin dir, then a bad program could put a replacement "ls" or something in that bin dir and then it would get used instead of /bin/ls. It only takes one binary or script to get executed one time to completely own your box and even remove all the easy evidence for you to even know it ever happened, in a fraction of one second.

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >