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

2015-06-18 Thread Hendrik Lüth
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@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2015-06-11 Thread Hendrik Lüth
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.2
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2015-06-10 Thread Hendrik Lüth
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@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


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

2015-06-10 Thread Hendrik Lüth

Am 10.06.2015 um 14:31 schrieb Bastian Bittorf:

* Matthias Schiffer mschif...@universe-factory.net [10.06.2015 14:26]:

Why should errors in these files cause login issues? This is shell and
there's no -e, problematic lines will print an error and be skipped.

i have seen a lot of strange things. think about
flash readerrors or stack corruption or $youridea 8-)

i think we can agree that we will not use a subshell,
but ignore profile.d in failsafe mode, ok? the 'sh -n'
thing is just a small 'insurance' - do you think it hurts/is too much?

bye, bastian


I'd like to see, that the scripts in profile.d are getting called 
without the 'sh' because those scripts could be written in Lua, too.
Weather a script needs to get called in failsafe mode or not depends on 
the script, so I'd like to not skip it.


regards, Hendrik
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel