Since my vacation is coming to an end I thought I’d leave a nice little trick on how to administrate a number of environment variable additions for all users on the system.
Sure, there is the /etc/environment file but it seems rather limiting to me. I needed a little more control, so I came up with the following the little scripting:
Create a new folder /etc/environment.imports, in the folder just have a ordered/leveled number of scripts (i.e. 01_qt, 02_java). Add the following code to your /etc/profile:
# Custom PATH and LD_LIBRARY additions xdg_source_list=`echo /etc/environment.imports/*` for source_file in $xdg_source_list do        source $source_file done
Now you can just export all the necessary additions through the files in /etc/environment.imports:
#!/bin/sh export LD_LIBRARY_PATH=/opt/wine/lib:$LD_LIBRARY_PATH export PATH=/opt/wine/bin:$PATH export PKG_CONFIG_PATH=/opt/wine/lib/pkgconfig:$PKG_CONFIG_PATH export XDG_DATA_DIRS=/opt/wine/share:$XDG_DATA_DIRS
This way it’s extremely easy to maintain a large number of custom-prefixed software for a complete system without touching the user’s custom profile.