aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-11-26 09:56:22 +0000
committerRoy Marples <roy@marples.name>2007-11-26 09:56:22 +0000
commit49edf58fc15c8d8aeccffe1dd4b579a5b44dcaeb (patch)
tree16a5f97460de237f971466e39310720a2ca64dc6 /sh
parent7921d9f3d09db8d5ee211b6f40cf4e50ff3bef89 (diff)
Don't rely on sed being available when calculating deps
Diffstat (limited to 'sh')
-rwxr-xr-xsh/net.sh18
1 files changed, 13 insertions, 5 deletions
diff --git a/sh/net.sh b/sh/net.sh
index 133b5996..47ec2ffd 100755
--- a/sh/net.sh
+++ b/sh/net.sh
@@ -35,10 +35,22 @@ description="Configures network interfaces."
# Handy var so we don't have to embed new lines everywhere for array splitting
__IFS="
"
+_shell_var() {
+ local rem=$1 c= r=
+ while [ -n "${rem}" ]; do
+ r=${rem#?}
+ c=${rem%${r}}
+ case "${c}" in
+ [a-zA-Z0-9]) printf "%c" "${c}";;
+ *) printf "_";;
+ esac
+ rem=${r}
+ done
+}
depend() {
local IFACE=${SVCNAME#*.}
- local IFVAR=$(echo -n "${IFACE}" | sed -e 's/[^[:alnum:]]/_/g')
+ local IFVAR=$(_shell_var "${IFACE}")
need localmount
after bootmisc
@@ -62,10 +74,6 @@ depend() {
esac
}
-_shell_var() {
- echo -n "$1" | sed -e 's/[^[:alnum:]]/_/g'
-}
-
# Support bash arrays - sigh
_get_array() {
local _a=