Author: blogic Date: 2015-09-16 10:32:13 +0200 (Wed, 16 Sep 2015) New Revision: 46965
Modified: trunk/package/base-files/files/etc/profile Log: 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?\195?\188th <[email protected]> v2 changes regarding RFC (e.g. [email protected]) v3 changes regarding RFC (e.g. [email protected]) v4 keep it simple and mimic OpenWrt style Signed-off-by: Bastian Bittorf <[email protected]> Modified: trunk/package/base-files/files/etc/profile =================================================================== --- trunk/package/base-files/files/etc/profile 2015-09-16 08:32:01 UTC (rev 46964) +++ trunk/package/base-files/files/etc/profile 2015-09-16 08:32:13 UTC (rev 46965) @@ -14,3 +14,10 @@ [ -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 +} _______________________________________________ openwrt-commits mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits
