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: init.d/
Date: Sun, 21 Apr 2019 05:34:14
Message-Id: 1555824820.1ae3f8e257032e753713b6582e23121984c0f9fa.robbat2@OpenRC
1 commit: 1ae3f8e257032e753713b6582e23121984c0f9fa
2 Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
3 AuthorDate: Sun Apr 21 05:28:15 2019 +0000
4 Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
5 CommitDate: Sun Apr 21 05:33:40 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1ae3f8e2
7
8 init.d/net.lo.in: shellcheck: start()
9
10 Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
11
12 init.d/net.lo.in | 30 +++++++++++++++++++-----------
13 1 file changed, 19 insertions(+), 11 deletions(-)
14
15 diff --git a/init.d/net.lo.in b/init.d/net.lo.in
16 index e1a0cab..9ba2e03 100644
17 --- a/init.d/net.lo.in
18 +++ b/init.d/net.lo.in
19 @@ -632,9 +632,17 @@ is_interface_type()
20
21 start()
22 {
23 - local IFACE=$(get_interface) oneworked=false fallback=false module=
24 - local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
25 - local metric=0 _up_before_preup
26 + local IFACE=''
27 + local IFVAR=''
28 + local oneworked=false
29 + local fallback=false
30 + local module=''
31 + local cmd=''
32 + local our_metric=''
33 + local metric=0
34 + local _up_before_preup=''
35 + IFACE=$(get_interface)
36 + IFVAR=$(shell_var "${IFACE}")
37 eval _up_before_preup="\$up_before_preup_${IFVAR}"
38 # shellcheck disable=SC2154
39 [ -z "${_up_before_preup}" ] && _up_before_preup=$up_before_preup
40 @@ -682,14 +690,14 @@ start()
41 return 1
42 fi
43
44 - local config= config_index=
45 + local config='' config_index=''
46 _load_config
47 config_index=0
48
49 eval our_metric=\$metric_${IFVAR}
50 if [ -n "${our_metric}" ]; then
51 metric=${our_metric}
52 - elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
53 + elif [ "${IFACE}" != "lo" ] && [ "${IFACE}" != "lo0" ]; then
54 : $(( metric += $(_ifindex) ))
55 fi
56
57 @@ -698,7 +706,7 @@ start()
58 [ -z "${config}" ] && break
59
60 set -- ${config}
61 - if [ "$1" != "null" -a "$1" != "noop" ]; then
62 + if [ "$1" != "null" ] && [ "$1" != "noop" ]; then
63 ebegin "$1"
64 fi
65 eindent
66 @@ -754,7 +762,7 @@ start()
67 if [ -z "${routes}" ]; then
68 routes="$(_get_array "routes_${IFVAR}")"
69 fi
70 - if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
71 + if [ "${IFACE}" = "lo" ] || [ "${IFACE}" = "lo0" ]; then
72 if [ "${config_0}" != "null" ]; then
73 routes="127.0.0.0/8 via 127.0.0.1
74 ${routes}"
75 @@ -780,11 +788,11 @@ ${routes}"
76 ebegin ${cmd}
77 # Work out if we're a host or a net if not told
78 case ${cmd} in
79 - -net" "*|-host" "*);;
80 - *" "netmask" "*) cmd="-net ${cmd}";;
81 + -net\ *|-host\ *);;
82 + *\ netmask\ *) cmd="-net ${cmd}";;
83 *.*.*.*/32*) cmd="-host ${cmd}";;
84 - *.*.*.*/*|0.0.0.0|0.0.0.0" "*) cmd="-net ${cmd}";;
85 - default|default" "*) cmd="-net ${cmd}";;
86 + *.*.*.*/*|0.0.0.0|0.0.0.0\ *) cmd="-net ${cmd}";;
87 + default|default\ *) cmd="-net ${cmd}";;
88 *:*/128*) cmd="-host ${cmd}";;
89 *:*/*) cmd="-net ${cmd}";;
90 *) cmd="-host ${cmd}";;