[OpenWrt-Devel] [PATCH] base-files: add /etc/profile.d support

Hendrik Lüth hendrik at linux-nerds.de
Wed Jun 10 06:29:24 EDT 2015


OpenWrt should support an optinal /etc/profile.d directory like most other Linux
distributions. This allows packages to install their own scripts into
/etc/profile.d/.
---
 package/base-files/files/etc/profile | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
index 3dd58e1..c9e805f 100644
--- a/package/base-files/files/etc/profile
+++ b/package/base-files/files/etc/profile
@@ -14,3 +14,12 @@ export PS1='\u@\h:\w\$ '
 
 [ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
 [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+
+if [ -d /etc/profile.d ]; then
+  for i in /etc/profile.d/* ; do
+    if [ -r $i ]; then
+      . $i
+    fi
+  done
+  unset i
+fi
-- 
2.4.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list