openSuse /etc/profile.local file does not exist

5,722

The /etc/profile.local file used to be the location to make system specific changes that would not be overwritten when /etc/profile would get an update.

Your system might still source the file if it exists, you could either check /etc/profile to see if it does (search for the profile.local filename, or just create the file and try out.

However, if you have a directory /etc/profile.d, and if your /etc/profile has something like (this is from Ubuntu 12.04) the following in it:

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi

then this mechanism sources (. $i) each of the files found in that directory. That is a more modern solution to the single .local file (with the advantage of different packages being able to drop in their files and remove them as needed without breaking something else). If your OpenSUSE has something like that, you can just create a file /etc/profile.d/your_name.sh and put the required code in there.

If you don't have all of that you can add the lines directly to /etc/profile, but you do run the risk of loosing your changes on a package upgrade.

Share:
5,722

Related videos on Youtube

Harbir
Author by

Harbir

Updated on September 18, 2022

Comments

  • Harbir
    Harbir over 1 year

    I am referring to the following URL Setting the JAVA_HOME

    I am interested in the last solution given by Nils, that edit the /etc/profile.local file, this will set it for all the users. The question is that I am using openSUSE 12.3 and it does not have /etc/profile.local.

    What should be done in this case?

  • Harbir
    Harbir almost 10 years
    I have tried this, as there is no file profile.local in /etc/ ,I have created a new /etc/profile.local and edited it with JAVA_HOME=/usr/java/jdk1.7.0_05 export JAVA_HOME