From b44e38866f1fd4b32fb83787e82552f3af83c042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hendrik=20L=C3=BCth?= Date: Fri, 4 Sep 2015 10:54:27 +0200 Subject: [PATCH] patch: add /etc/profiles.d support --- ...base-files-add-etc-profile.d-support.patch | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 patches/openwrt/0025-base-files-add-etc-profile.d-support.patch diff --git a/patches/openwrt/0025-base-files-add-etc-profile.d-support.patch b/patches/openwrt/0025-base-files-add-etc-profile.d-support.patch new file mode 100644 index 00000000..099a5b38 --- /dev/null +++ b/patches/openwrt/0025-base-files-add-etc-profile.d-support.patch @@ -0,0 +1,29 @@ +From: Hendrik Lüth +Date: Wed, 10 Jun 2015 07:47:58 +0200 +Subject: base-files: add /etc/profile.d support + +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/. + +Signed-off-by: Hendrik Lüth + +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 $*; } ++ ++[ -z "$FAILSAFE" ] && { ++ if [ -d /etc/profile.d ]; then ++ for i in /etc/profile.d/*.sh ; do ++ if [ -r $i ]; then ++ . $i ++ fi ++ done ++ fi ++} +