[Buildroot] [git commit] /etc/profile: read in /etc/profile.d/*.sh files

Peter Korsgaard jacmet at sunsite.dk
Fri Oct 28 12:59:27 UTC 2011


commit: http://git.buildroot.net/buildroot/commit/?id=2c8502e8211d6153830929110611ce18956ae42c
branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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 at gmail.com>
Signed-off-by: Peter Korsgaard <jacmet at sunsite.dk>
---
 fs/skeleton/etc/profile |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/fs/skeleton/etc/profile b/fs/skeleton/etc/profile
index cc2e0be..31d3180 100644
--- a/fs/skeleton/etc/profile
+++ b/fs/skeleton/etc/profile
@@ -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


More information about the buildroot mailing list