From f2e404ab66b2c7eb22de4f9d01a444225b1ff616 Mon Sep 17 00:00:00 2001 From: William Hubbs Date: Sat, 7 Jan 2012 13:09:17 -0600 Subject: net.lo: Add the ability to find the full path of a binary Some of the networking tools, such as iproute2, can be stored in one of several locations. This function gives us a standard way to find these tools. I would like to thankRobin Johnson for his input on this function. --- init.d/net.lo.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/init.d/net.lo.in b/init.d/net.lo.in index 0752400..de393bd 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -169,6 +169,18 @@ _configure_variables() done } +_which() +{ + local i OIFS + [ -z "$1" ] && return + OIFS="$IFS" + IFS=: + for i in $PATH ; do + [ -x $i/$1 ] && echo $i/$1 && break + done + IFS=$OIFS +} + _show_address() { einfo "received address $(_get_inet_address "${IFACE}")" -- cgit v1.2.3