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

Hendrik Lüth hendrik at linux-nerds.de
Thu Jun 18 09:56:34 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/. This is the second version, which includes suggestions from
the mailing-list.
---
 package/base-files/files/etc/profile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile
index 3dd58e1..d7129c3 100644
--- a/package/base-files/files/etc/profile
+++ b/package/base-files/files/etc/profile
@@ -14,3 +14,13 @@ export PS1='\u@\h:\w\$ '
 
 [ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; }
 [ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; }
+
+[ -z "$FAILSAFE" ] && {
+  if [ -d /etc/profile.d ]; then
+    for i in /etc/profile.d/*.sh ; do
+      if [ -r $i ]; then
+        . $i
+      fi
+    done
+  fi
+}
-- 
2.4.3
_______________________________________________
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