Gentoo Archives: gentoo-commits

From: "Robin H. Johnson" <robbat2@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/netifrc:master commit in: sh/
Date: Sun, 21 Apr 2019 05:34:06
Message-Id: 1555823845.b862d25a8ad39d79fdb4564447f1bb8cd33cb6bf.robbat2@OpenRC
1 commit: b862d25a8ad39d79fdb4564447f1bb8cd33cb6bf
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 21 05:17:25 2019 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 21 05:17:25 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=b862d25a
7
8 sh/udhcpc-hook.sh: shellcheck fixes
9
10 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
11
12 sh/udhcpc-hook.sh.in | 7 ++++---
13 1 file changed, 4 insertions(+), 3 deletions(-)
14
15 diff --git a/sh/udhcpc-hook.sh.in b/sh/udhcpc-hook.sh.in
16 index 13ea336..e4300c1 100644
17 --- a/sh/udhcpc-hook.sh.in
18 +++ b/sh/udhcpc-hook.sh.in
19 @@ -68,7 +68,7 @@ update_classless_routes()
20 max_routes=128
21 metric=
22 [ -n "${IF_METRIC}" ] && metric="metric ${IF_METRIC}"
23 - while [ -n "$1" -a -n "$2" -a $max_routes -gt 0 ]; do
24 + while [ -n "$1" ] && [ -n "$2" ] && [ $max_routes -gt 0 ]; do
25 gw_arg=
26 if [ "$2" != '0.0.0.0' ]; then
27 gw_arg="gw $2"
28 @@ -76,7 +76,7 @@ update_classless_routes()
29
30 [ ${1##*/} -eq 32 ] && type=host || type=net
31 route add -$type "$1" ${gw_arg} ${metric} dev "${interface}"
32 - max=$(($max-1))
33 + max=$((max-1))
34 shift 2
35 done
36 fi
37 @@ -90,7 +90,7 @@ update_routes()
38
39 # If the DHCP server returns both a Classless Static Routes option and
40 # a Router option, the DHCP client MUST ignore the Router option.
41 - if [ -n "${router}" -a -z "${staticroutes}" ] ; then
42 + if [ -n "${router}" ] && [ -z "${staticroutes}" ] ; then
43 metric=
44 [ -n "${IF_METRIC}" ] && metric="metric ${IF_METRIC}"
45 for i in ${router} ; do
46 @@ -115,6 +115,7 @@ deconfig()
47 }
48
49 if [ -r "/run/udhcpc-${interface}.conf" ]; then
50 + # shellcheck disable=SC1090
51 . "/run/udhcpc-${interface}.conf"
52 fi