aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2015-09-16 08:32:13 +0000
committerJohn Crispin <blogic@openwrt.org>2015-09-16 08:32:13 +0000
commit5faa75e5831c54463fbdd9d491ae6c2c39e30b42 (patch)
treef83f92d16026b298d6ba048c8b2ce81e64e2b463 /package/base-files/files
parenta24b6d1ca2e301e4d36410f378a5ea638f3329ba (diff)
downloadmaster-187ad058-5faa75e5831c54463fbdd9d491ae6c2c39e30b42.tar.gz
master-187ad058-5faa75e5831c54463fbdd9d491ae6c2c39e30b42.tar.bz2
master-187ad058-5faa75e5831c54463fbdd9d491ae6c2c39e30b42.zip
base-files: add /etc/profile.d support
OpenWrt should support an optional /etc/profile.d directory like most other Linux distributions. This allows packages to install their own scripts into /etc/profile.d/ directory. The file suffix should make clear, that these scripts are (sourced) shell-snippets. If the user needs e.g. php or lua, one must make sure that the interpreter is called. The reverse failsafe test makes sure, that the effective returncode is 0. A typcal usecase is the inclusion of private helpers, special variables or aliases, which at the moment needs patching the sourcecode and is not well maintainable. Now the builder can simply add there files. v1 initial work of Hendrik Lüth <hendrik@linux-nerds.de> v2 changes regarding RFC (e.g. thomas.langer@lantiq.com) v3 changes regarding RFC (e.g. mschiffer@universe-factory.net) v4 keep it simple and mimic OpenWrt style Signed-off-by: Bastian Bittorf <bittorf@bluebottle.com> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@46965 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/etc/profile7
1 files changed, 7 insertions, 0 deletions
diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
index 3dd58e14f2..577b63b492 100644
--- a/package/base-files/files/etc/profile
+++ b/package/base-files/files/etc/profile
@@ -14,3 +14,10 @@ export PS1='\u@\h:\w\$ '
[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+
+[ -n "$FAILSAFE" ] || {
+ for FILE in /etc/profile.d/*.sh; do
+ [ -e "$FILE" ] && . "$FILE"
+ done
+ unset FILE
+}