* [gentoo-commits] proj/netifrc:master commit in: net/, init.d/
@ 2016-10-24 0:04 Robin H. Johnson
0 siblings, 0 replies; only message in thread
From: Robin H. Johnson @ 2016-10-24 0:04 UTC (permalink / raw
To: gentoo-commits
commit: 7242a8d22d0a441c54824bef37c09731e4918587
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 24 00:02:32 2016 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 00:02:32 2016 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=7242a8d2
iproute2: clean up error output and make sure it works.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 4 +++-
net/iproute2.sh | 28 +++++++++++++---------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 3b47f1a..dbade70 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -248,7 +248,7 @@ _get_errorhandler_behavior() {
"errh_DEFAULT_DEFAULT_DEFAULT" \
"errh" \
"fallback" ; do
- eval value="\${key}"
+ eval value="\${${key}}"
if [ -n "$value" ]; then
echo "$value" && break
fi
@@ -844,3 +844,5 @@ stop()
return 0
}
+
+# vim:filetype=gentoo-init-d:
diff --git a/net/iproute2.sh b/net/iproute2.sh
index 2c9f6bb..b6fd847 100644
--- a/net/iproute2.sh
+++ b/net/iproute2.sh
@@ -112,7 +112,7 @@ _add_address()
local confflaglist family raw_address family_maxnetmask
raw_address="$1" ; shift
# Extract the netmask on address if present.
- if [ "${address%\/*}" != "${address}" ]; then
+ if [ "${raw_address%\/*}" != "${raw_address}" ]; then
address="${raw_address%\/*}"
netmask="${raw_address#*\/}"
else
@@ -193,15 +193,14 @@ _add_address()
# You can completely silence this with: errh_IFVAR_address_EEXIST=continue
if [ $address_already_exists -eq 0 ]; then
eh_behavior=$(_get_errorhandler_behavior "$IFVAR" "address" "EEXIST" "warn")
- abort=0
case $eh_behavior in
- continue) msgfunc=true ;;
- info) msgfunc=einfo ;;
- warn) msgfunc=ewarn ;;
- error|fatal) msgfunc=eerror abort=1;;
+ continue) msgfunc=true rc=0 ;;
+ info) msgfunc=einfo rc=0 ;;
+ warn) msgfunc=ewarn rc=0 ;;
+ error|fatal) msgfunc=eerror rc=1;;
esac
- $msgfunc "Address ${address}${netmask:+/}${netmask} already existed: $(ip addr show to "${address}/${family_maxnetmask}" dev "${IFACE}" 2>&1)"
- [ $abort -eq 1 ] && rc=1
+ eval $msgfunc "Address ${address}${netmask:+/}${netmask} already existed!"
+ eval $msgfunc \"$(ip addr show to "${address}/${family_maxnetmask}" dev "${IFACE}" 2>&1)\"
else
: # TODO: Handle other errors
fi
@@ -265,15 +264,14 @@ _add_route()
# You can completely silence this with: errh_IFVAR_route_EEXIST=continue
if [ $route_already_exists -eq 0 ]; then
eh_behavior=$(_get_errorhandler_behavior "$IFVAR" "route" "EEXIST" "warn")
- abort=0
case $eh_behavior in
- continue) msgfunc=true ;;
- info) msgfunc=einfo ;;
- warn) msgfunc=ewarn ;;
- error|fatal) msgfunc=eerror abort=1;;
+ continue) msgfunc=true rc=0 ;;
+ info) msgfunc=einfo rc=0 ;;
+ warn) msgfunc=ewarn rc=0 ;;
+ error|fatal) msgfunc=eerror rc=1;;
esac
- $msgfunc "Route '$cmd' already existed: $(ip $family route show $cmd dev "${IFACE}" 2>&1)"
- [ $abort -eq 1 ] && rc=1
+ eval $msgfunc "Route '$cmd' already existed."
+ eval $msgfunc \"$(ip $family route show $cmd dev "${IFACE}" 2>&1)\"
else
: # TODO: Handle other errors
fi
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-10-24 0:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-24 0:04 [gentoo-commits] proj/netifrc:master commit in: net/, init.d/ Robin H. Johnson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox