/etc/profile: read in /etc/profile.d/*.sh files
authorThomas De Schampheleire <patrickdepinguin+buildroot@gmail.com>
Wed, 19 Oct 2011 07:36:02 +0000 (09:36 +0200)
committerPeter Korsgaard <jacmet@sunsite.dk>
Fri, 28 Oct 2011 12:59:27 +0000 (14:59 +0200)
For custom projects, it is more maintainable to add custom profile settings
in a separate file, than directly in /etc/profile.

This patch modifies /etc/profile to read in *.sh files from /etc/profile.d/,
a technique commonly used in Linux distributions.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
fs/skeleton/etc/profile

index cc2e0beb87bc855836cf184db4deaac2aad09b74..31d3180c0dc352c3f95e7db30957d8c204dcb734 100644 (file)
@@ -46,3 +46,10 @@ if [ "$PS1" ]; then
     alias calc='calc -Cd '
     alias bc='calc -Cd '
 fi;
+
+# Source configuration files from /etc/profile.d
+for i in /etc/profile.d/*.sh ; do
+    if [ -r "$i" ]; then
+        . $i
+    fi
+done