Install subscribers without the execute bit.
authorRoy Marples <roy@marples.name>
Thu, 3 Dec 2009 14:36:12 +0000 (14:36 +0000)
committerRoy Marples <roy@marples.name>
Thu, 3 Dec 2009 14:36:12 +0000 (14:36 +0000)
If a subscriber has the execute then it is executed, otherwise it
is sourced into a subshell for speed.
This allows subcribers to be written in other languages.

Makefile
libc.in
resolvconf.8.in
resolvconf.in

index 10371a6654127b1fad122f2a23c59dd8c281a651..8d29fbb599275eda268f9451af3789d090dc8898 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -66,7 +66,7 @@ install: ${TARGET}
        ${INSTALL} -d ${DESTDIR}${SYSCONFDIR}
        ${INSTALL} -m ${DOCMODE} resolvconf.conf ${DESTDIR}${SYSCONFDIR}
        ${INSTALL} -d ${DESTDIR}${LIBEXECDIR}
-       ${INSTALL} -m ${BINMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
+       ${INSTALL} -m ${DOCMODE} ${SUBSCRIBERS} ${DESTDIR}${LIBEXECDIR}
        ${INSTALL} -d ${DESTDIR}${MANDIR}/man8
        ${INSTALL} -m ${MANMODE} resolvconf.8 ${DESTDIR}${MANDIR}/man8
        ${INSTALL} -d ${DESTDIR}${MANDIR}/man5
diff --git a/libc.in b/libc.in
index 0037ef020d381af5d2595b643b09a7eb2fcc2069..4ed75a2eaebe2d313136c3a3e016e0da8f7d86d1 100644 (file)
--- a/libc.in
+++ b/libc.in
@@ -154,8 +154,12 @@ eval $libc_restart
 retval=0
 # Notify users of the resolver
 for script in "$LIBEXECDIR"/libc.d/*; do
-       if [ -f "$script" -a -x "$script" ]; then
-               "$script" "$@"
+       if [ -f "$script" ]; then
+               if [ -x "$script" ]; then
+                       "$script" "$@"
+               else
+                       (. "$script" "$@")
+               fi
                retval=$(($retval + $?))
        fi
 done
index c60aa28eaf63badf3a5781dadbebba34ce2b1f5a..4e6f59a0449e08a21a307116508d7f65f91f3ec8 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd November 22, 2009
+.Dd December 3, 2009
 .Dt RESOLVCONF 8 SMM
 .Os
 .Sh NAME
@@ -170,6 +170,21 @@ the operating systems lexical order.
 See
 .Xr resolvconf.conf 5
 for details on these lists.
+.Sh IMPLEMENTATION NOTES
+If a subscriber has the executable bit then it is executed otherwise it is
+assumed to be a shell script and sourced into the current environment in a
+subshell.
+This is done so that subscribers can remain fast, but are also not limited
+to the shell language.
+.Pp
+Portable subscribers should not use anything outside of
+.Pa /bin
+and
+.Pa /sbin
+because
+.Pa /usr
+and others may not be available when booting.
+Also, it would be unwise to assume any shell specific features.
 .Sh ENVIRONMENT
 .Bl -ohang
 .It Va IF_METRIC
@@ -215,8 +230,6 @@ You should consult
 .Xr resolvconf.conf 5
 for instructions on how to configure your resolver.
 .Sh SEE ALSO
-.Xr dnsmasq 8 ,
-.Xr named 8 ,
 .Xr resolv.conf 5 ,
 .Xr resolvconf.conf 5 ,
 .Xr resolver 3 ,
index 432852d96c6ca70d681c133a80055f32f60fd715..77578615c4cefd2a471395a3ca6be71656227bf1 100644 (file)
@@ -394,8 +394,13 @@ eval "$(make_vars)"
 : ${list_resolv:=list_resolv -l}
 retval=0
 for script in "$LIBEXECDIR"/*; do
-       [ -f "$script" ] || continue
-       ( . "$script" "$cmd" "$iface" )
-       retval=$(($retval + $?))
-done
+       if [ -f "$script" ]; then
+               if [ -x "$script" ]; then
+                       "$script" "$cmd" "$iface"
+               else
+                       (. "$script" "$cmd" "$fiace")
+               fi
+               retval=$(($retval + $?))
+       fi
+    done
 exit $retval