* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2014-07-17 17:56 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2014-07-17 17:56 UTC (permalink / raw
To: gentoo-commits
commit: e9212e5164877056cb44bd1be542f0ab8c1c0f1a
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 16 19:07:56 2014 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Wed Jul 16 19:16:39 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=e9212e51
net.lo: cached module list timing issue
Handle cached modulelist being newer than current time, as it would not
be recached even when needed; force recache.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
X-Gentoo-Bug: 506966
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=506966
---
init.d/net.lo.in | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 5ea73c7..01c1b20 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -218,16 +218,20 @@ _show_address()
_gen_module_list()
{
local x= f= force=$1
- if ! ${force} && [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ]; then
- local update=false
- for x in "${MODULESDIR}"/*.sh; do
- [ -e "${x}" ] || continue
- if [ "${x}" -nt "${MODULESLIST}" ]; then
- update=true
- break
- fi
- done
- ${update} || return 0
+ if ! ${force} ; then
+ if [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt /proc/$$/status ]; then
+ ewarn "Discarding cached module list ($MODULESLIST) as it's newer current time!"
+ elif [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ]; then
+ local update=false
+ for x in "${MODULESDIR}"/*.sh; do
+ [ -e "${x}" ] || continue
+ if [ "${x}" -nt "${MODULESLIST}" ]; then
+ update=true
+ break
+ fi
+ done
+ ${update} || return 0
+ fi
fi
einfo "Caching network module dependencies"
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2014-10-11 19:47 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2014-10-11 19:47 UTC (permalink / raw
To: gentoo-commits
commit: 3a97f7c0dd702d55e1280c1153d44ee8747fe1f4
Author: mirabilos <tg <AT> debian <DOT> org>
AuthorDate: Fri Oct 10 21:58:11 2014 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sat Oct 11 19:47:17 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=3a97f7c0
Fix https://bugs.gentoo.org/show_bug.cgi?id=500942
“unset x” also removes the “local x” property, so the next assignment and/or read to/from $x will access the global variable “x”.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
---
init.d/net.lo.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 01c1b20..6a0aefb 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -203,7 +203,7 @@ _program_available()
/*) [ -x "${x}" ] && break;;
*) type "${x}" >/dev/null 2>&1 && break;;
esac
- unset x
+ x=
done
[ -n "${x}" ] && echo $x && return 0
return 1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2015-01-09 17:17 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2015-01-09 17:17 UTC (permalink / raw
To: gentoo-commits
commit: ecba7604cf633342162deb802cb18008c55b0382
Author: Rabi Shanker Guha <guha.rabishankar <AT> gmail <DOT> com>
AuthorDate: Fri Jan 9 15:08:13 2015 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Jan 9 15:08:13 2015 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/netifrc.git;a=commit;h=ecba7604
Update runscript to use functions.sh compatibility layer
---
init.d/net.lo.in | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 6a0aefb..c79e7ff 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -2,6 +2,7 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
+SHDIR="@LIBEXECDIR@/sh"
MODULESDIR="@LIBEXECDIR@/net"
MODULESLIST="${RC_SVCDIR}/nettree"
_config_vars="config routes"
@@ -13,9 +14,20 @@ description="Configures network interfaces."
# Handy var so we don't have to embed new lines everywhere for array splitting
__IFS="
"
+
+# Set the INIT to be openrc if this file is called directly
+: ${INIT:=openrc}
+
+if [ -f "$SHDIR/functions.sh" ]; then
+ . "$SHDIR/functions.sh"
+else
+ echo "$SHDIR/functions.sh missing. Exiting"
+ exit -1
+fi
+
depend()
{
- local IFACE=${RC_SVCNAME#*.}
+ local IFACE=$(get_interface)
local IFVAR=$(shell_var "${IFACE}")
need localmount
@@ -526,7 +538,7 @@ interface_down()
start()
{
- local IFACE=${RC_SVCNAME#*.} oneworked=false fallback=false module=
+ local IFACE=$(get_interface) oneworked=false fallback=false module=
local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
local metric=0 _up_before_preup
eval _up_before_preup="\$up_before_preup_${IFVAR}"
@@ -721,7 +733,7 @@ stop()
# correctly if we go back to multiuser.
yesno ${keep_network:-YES} && yesno $RC_GOINGDOWN && return 0
- local IFACE=${RC_SVCNAME#*.} module=
+ local IFACE=$(get_interface) module=
local IFVAR=$(shell_var "${IFACE}") opts=
einfo "Bringing down interface ${IFACE}"
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2015-05-25 10:01 Mike Frysinger
0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2015-05-25 10:01 UTC (permalink / raw
To: gentoo-commits
commit: fb47f01605857f09614013d23014ad5a6899e9f7
Author: Patrick McLean <patrickm <AT> gaikai <DOT> com>
AuthorDate: Thu Jan 29 01:04:41 2015 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jan 29 01:04:41 2015 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=fb47f016
lo should not have a "need" dependency on localmount
init.d/net.lo.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index e9e7f7c..bdb3747 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -30,9 +30,9 @@ depend()
local IFACE=$(get_interface)
local IFVAR=$(shell_var "${IFACE}")
- need localmount
if [ "$RC_UNAME" = Linux -a "$IFACE" != lo ]; then
need sysfs
+ after modules
fi
after bootmisc
keyword -jail -prefix -vserver
@@ -41,6 +41,7 @@ depend()
lo|lo0) ;;
*)
after net.lo net.lo0 dbus
+ need localmount
provide net
;;
esac
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2015-05-25 10:04 Mike Frysinger
0 siblings, 0 replies; 31+ messages in thread
From: Mike Frysinger @ 2015-05-25 10:04 UTC (permalink / raw
To: gentoo-commits
commit: 902d48c8bd46dd67565371cb5d2c84f91ad30b8e
Author: Thomas D <whissi <AT> whissi <DOT> de>
AuthorDate: Wed Apr 16 09:52:56 2014 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Tue Mar 10 16:14:49 2015 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=902d48c8
_wait_for_carrier(): Workaround for output when using rc_parallel="YES" is no longer needed
_wait_for_carrier() was using a workaround when rc_parallel is enabled.
This caused the following broken output:
https://bugs.gentoo.org/attachment.cgi?id=361054
This patch fixes bug 488256 by removing the workaround, because this
workaround isn't needed anymore.
X-Gentoo-Bug: 488256
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=488256
init.d/net.lo.in | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index bdb3747..e883f98 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -116,7 +116,7 @@ _flatten_array()
_wait_for_carrier()
{
- local timeout= efunc=einfon
+ local timeout=
_has_carrier && return 0
@@ -126,20 +126,19 @@ _wait_for_carrier()
# Incase users don't want this nice feature ...
[ ${timeout} -le 0 ] && return 0
- yesno ${RC_PARALLEL} && efunc=einfo
- ${efunc} "Waiting for carrier (${timeout} seconds) "
+ einfon "Waiting for carrier (${timeout} seconds) "
while [ ${timeout} -gt 0 ]; do
if _has_carrier; then
- [ "${efunc}" = "einfon" ] && echo
+ echo
eend 0
return 0
fi
sleep 1
: $(( timeout -= 1 ))
- [ "${efunc}" = "einfon" ] && printf "."
+ printf "."
done
- [ "${efunc}" = "einfon" ] && echo
+ echo
eend 1
return 1
}
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2015-11-08 14:30 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2015-11-08 14:30 UTC (permalink / raw
To: gentoo-commits
commit: e65e9b5065f6c11f89428ec3788c49ed1422d9ba
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 8 14:08:09 2015 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Nov 8 14:08:09 2015 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=e65e9b50
Update copyright on net.lo.in for significent gentoo changes.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index e883f98..2611e3e 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -1,5 +1,6 @@
#!@SBINDIR@/runscript
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
+# Copyright (c) 2010-2015 Gentoo Foundation
# Released under the 2-clause BSD license.
SHDIR="@LIBEXECDIR@/sh"
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2015-11-08 14:30 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2015-11-08 14:30 UTC (permalink / raw
To: gentoo-commits
commit: 756591785d521af36a30b5a74d58be733a94e596
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 8 14:09:33 2015 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Nov 8 14:09:33 2015 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=75659178
New functions: set/get/is_interface_type to persistently track type of interfaces despite conf.d/net changes.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
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 2611e3e..31a45e6 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -536,6 +536,18 @@ interface_down()
{
_run_if _down "$@"
}
+set_interface_type()
+{
+ service_set_value iface_type "$@"
+}
+get_interface_type()
+{
+ ( RC_SVCNAME="net.$IFACE" service_get_value iface_type )
+}
+is_interface_type()
+{
+ [ "$(get_interface_type)" = "$1" ]
+}
start()
{
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2016-07-05 18:13 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2016-07-05 18:13 UTC (permalink / raw
To: gentoo-commits
commit: 9b3dc52ac99397eec0be909ce87c4ecab028661a
Author: Thomas Deutschmann <whissi <AT> whissi <DOT> de>
AuthorDate: Sun Jun 12 21:18:48 2016 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Jun 12 21:18:48 2016 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=9b3dc52a
net.lo: use #!/sbin/openrc-run instead of #!/sbin/runscript
See: https://bugs.gentoo.org/573846
init.d/net.lo.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 31a45e6..a8e19dd 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -1,6 +1,6 @@
-#!@SBINDIR@/runscript
+#!@SBINDIR@/openrc-run
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
-# Copyright (c) 2010-2015 Gentoo Foundation
+# Copyright (c) 2010-2016 Gentoo Foundation
# Released under the 2-clause BSD license.
SHDIR="@LIBEXECDIR@/sh"
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2016-10-23 23:50 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2016-10-23 23:50 UTC (permalink / raw
To: gentoo-commits
commit: e337a9906e526b4b60fea7d260a4b21badb89ca1
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 23 23:41:00 2016 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Oct 23 23:41:00 2016 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=e337a990
net.lo: framework for error handling customization.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index a8e19dd..3b47f1a 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -227,6 +227,34 @@ _show_address()
einfo "received address $(_get_inet_address "${IFACE}")"
}
+# Allow custom error handling behavior to be set by the user.
+# Known used combinations, with defaults
+# errh_IFVAR_address_EEXIST=warn
+# errh_IFVAR_route_EEXIST=warn
+_get_errorhandler_behavior() {
+ IFVAR="$1"
+ object="$2"
+ error="$3"
+ fallback="$4"
+ value=
+ for key in \
+ "errh_${IFVAR}_${object}_${error}" \
+ "errh_${IFVAR}_${object}_DEFAULT" \
+ "errh_${IFVAR}_DEFAULT_${error}" \
+ "errh_${IFVAR}_DEFAULT_DEFAULT" \
+ "errh_DEFAULT_${object}_${error}" \
+ "errh_DEFAULT_${object}_DEFAULT" \
+ "errh_DEFAULT_DEFAULT_${error}" \
+ "errh_DEFAULT_DEFAULT_DEFAULT" \
+ "errh" \
+ "fallback" ; do
+ eval value="\${key}"
+ if [ -n "$value" ]; then
+ echo "$value" && break
+ fi
+ done
+}
+
# Basically sorts our modules into order and saves the list
_gen_module_list()
{
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2016-10-24 0:23 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2016-10-24 0:23 UTC (permalink / raw
To: gentoo-commits
commit: 1705b16b61bf00a1c610a34aebe112e8f28e85b6
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 24 00:12:49 2016 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 00:12:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1705b16b
net.lo: display ALL routes
For historical reasons, we used to suppress the first route for an
interface, but this make it unclear what was being done.
Display all routes instead.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index dbade70..1a8feaa 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -693,7 +693,7 @@ start()
return 1
fi
- local hideFirstroute=false first=true routes=
+ local first=true routes=
if ${fallback}; then
routes="$(_get_array "fallback_routes_${IFVAR}")"
fi
@@ -704,7 +704,6 @@ start()
if [ "${config_0}" != "null" ]; then
routes="127.0.0.0/8 via 127.0.0.1
${routes}"
- hideFirstroute=true
fi
fi
@@ -736,12 +735,7 @@ ${routes}"
*:*/*) cmd="-net ${cmd}";;
*) cmd="-host ${cmd}";;
esac
- if ${hideFirstroute}; then
- _add_route ${fam} ${cmd} >/dev/null 2>&1
- hideFirstroute=false
- else
- _add_route ${fam} ${cmd} >/dev/null
- fi
+ _add_route ${fam} ${cmd} >/dev/null
eend $?
eoutdent
done
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2016-10-24 0:23 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2016-10-24 0:23 UTC (permalink / raw
To: gentoo-commits
commit: 0eea80cc3955c2965368ef84cc521dc0b5edca7b
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 24 00:14:29 2016 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 00:14:29 2016 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=0eea80cc
net.lo: do not hide any _add_route output.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 1a8feaa..72a5427 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -735,7 +735,7 @@ ${routes}"
*:*/*) cmd="-net ${cmd}";;
*) cmd="-host ${cmd}";;
esac
- _add_route ${fam} ${cmd} >/dev/null
+ _add_route ${fam} ${cmd}
eend $?
eoutdent
done
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2016-10-24 20:52 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2016-10-24 20:52 UTC (permalink / raw
To: gentoo-commits
commit: 2af03b659eb8028bc0dc5101a22ed31e330073f5
Author: Sven Wegener <swegener <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 4 20:11:01 2016 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Oct 24 20:52:32 2016 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=2af03b65
net.lo: Add metric to supported config variables
This allows us to use metric_<SSID> for configuration.
Signed-off-by: Sven Wegener <swegener <AT> gentoo.org>
(cherry picked from commit 3cd367c958e533bbeae011699eef0da2fdf1079e)
init.d/net.lo.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 72a5427..d7108a5 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -6,7 +6,7 @@
SHDIR="@LIBEXECDIR@/sh"
MODULESDIR="@LIBEXECDIR@/net"
MODULESLIST="${RC_SVCDIR}/nettree"
-_config_vars="config routes"
+_config_vars="config metric routes"
[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND="NO"
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2017-11-14 20:48 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2017-11-14 20:48 UTC (permalink / raw
To: gentoo-commits
commit: dbfe9a7fefa70150528a66aae380b7de52d15832
Author: Hagbard Celine <hagbardcelin <AT> gmail <DOT> com>
AuthorDate: Tue Nov 14 19:11:32 2017 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Nov 14 19:11:40 2017 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=dbfe9a7f
init.d/net.lo: per-iface moduleslist
Avoid race conditions in generation of modules list (nettree), and allow
per-interface custom module work more easily.
Closes: https://bugs.gentoo.org/637474
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index d7108a5..33cc932 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -5,7 +5,6 @@
SHDIR="@LIBEXECDIR@/sh"
MODULESDIR="@LIBEXECDIR@/net"
-MODULESLIST="${RC_SVCDIR}/nettree"
_config_vars="config metric routes"
[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND="NO"
@@ -26,6 +25,10 @@ else
exit 1
fi
+# Create per-interface nettree ordering, avoids race conditions and allows
+# per-interface custom modules.
+MODULESLIST="${RC_SVCDIR}/nettree$(get_interface)"
+
depend()
{
local IFACE=$(get_interface)
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2017-11-14 20:48 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2017-11-14 20:48 UTC (permalink / raw
To: gentoo-commits
commit: 66dc589e7478dc380c038c29073d8e438d80ed93
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 14 19:14:12 2017 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Nov 14 19:14:12 2017 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=66dc589e
init.d/net.lo: atomically create moduleslist.
Bug: https://bugs.gentoo.org/637474
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 33cc932..b78a342 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -353,21 +353,24 @@ _gen_module_list()
visit "${MODULE}"
done
- printf "" > "${MODULESLIST}"
+ # Create atomically
+ TMPMODULESLIST=${MODULESLIST}.$$
+ printf "" > "${TMPMODULESLIST}"
i=0
for MODULE in ${SORTED}; do
eval PROGRAM=\$${MODULE}_program
eval PROGRAM_START=\$${MODULE}_program_start
eval PROGRAM_STOP=\$${MODULE}_program_stop
eval PROVIDE=\$${MODULE}_provide
- echo "module_${i}='${MODULE}'" >> "${MODULESLIST}"
- echo "module_${i}_program='${PROGRAM}'" >> "${MODULESLIST}"
- echo "module_${i}_program_start='${PROGRAM_START}'" >> "${MODULESLIST}"
- echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${MODULESLIST}"
- echo "module_${i}_provide='${PROVIDE}'" >> "${MODULESLIST}"
+ echo "module_${i}='${MODULE}'" >> "${TMPMODULESLIST}"
+ echo "module_${i}_program='${PROGRAM}'" >> "${TMPMODULESLIST}"
+ echo "module_${i}_program_start='${PROGRAM_START}'" >> "${TMPMODULESLIST}"
+ echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${TMPMODULESLIST}"
+ echo "module_${i}_provide='${PROVIDE}'" >> "${TMPMODULESLIST}"
: $(( i += 1 ))
done
- echo "module_${i}=" >> "${MODULESLIST}"
+ echo "module_${i}=" >> "${TMPMODULESLIST}"
+ mv -f "${TMPMODULESLIST}" "${MODULESLIST}"
)
return 0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: d2d52cd821372c65b92d262da66a30794735204c
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:21:51 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:31:06 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=d2d52cd8
init.d/net.lo.in: shellcheck: disable some false positives
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index d9a4d24..1e5de3c 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -83,6 +83,7 @@ _get_array()
{
local _a=
if [ -n "${BASH}" ]; then
+ # shellcheck disable=SC2039
case "$(declare -p "$1" 2>/dev/null)" in
"declare -a "*)
ewarn "You are using a bash array for $1."
@@ -104,6 +105,7 @@ _get_array()
_flatten_array()
{
if [ -n "${BASH}" ]; then
+ # shellcheck disable=SC2039
case "$(declare -p "$1" 2>/dev/null)" in
"declare -a "*)
ewarn "You are using a bash array for $1."
@@ -111,6 +113,7 @@ _flatten_array()
ewarn "Please see net.example for the correct format for $1."
eval "set -- \"\${$1[@]}\""
for x; do
+ # shellcheck disable=SC2059
printf "'%s' " "$(printf "$x" | sed "s:':'\\\'':g")"
done
return 0
@@ -194,6 +197,7 @@ _netmask2cidr()
quad=${quad}${quad:+.}0x${hex%${lastbut2}*}
hex=${lastbut2}
done
+ # shellcheck disable=SC2086
set -- ${quad}
;;
esac
@@ -427,6 +431,7 @@ _load_modules()
MODULES=
if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
eval mymods=\$modules_${IFVAR}
+ # shellcheck disable=SC2154
[ -z "${mymods}" ] && mymods=${modules}
fi
@@ -627,6 +632,7 @@ start()
local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
local metric=0 _up_before_preup
eval _up_before_preup="\$up_before_preup_${IFVAR}"
+ # shellcheck disable=SC2154
[ -z "${_up_before_preup}" ] && _up_before_preup=$up_before_preup
einfo "Bringing up interface ${IFACE}"
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: bb833bd3afb35960a2faa879220697ea1f596546
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:19:44 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:30:34 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=bb833bd3
init.d/net.lo.in: shellcheck: _gen_module_list(), _load_modules()
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 3afe046..d9a4d24 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -10,6 +10,7 @@ _config_vars="config metric routes"
[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND="NO"
+# shellcheck disable=SC2034
description="Configures network interfaces."
# Handy var so we don't have to embed new lines everywhere for array splitting
@@ -20,6 +21,7 @@ __IFS="
: ${INIT:=openrc}
if [ -f "$SHDIR/functions.sh" ]; then
+ # shellcheck disable=SC1090
. "$SHDIR/functions.sh"
else
echo "$SHDIR/functions.sh missing. Exiting"
@@ -345,6 +347,7 @@ _gen_module_list()
for MODULE in "${MODULESDIR}"/*.sh; do
sh -n "${MODULE}" || continue
+ # shellcheck disable=SC1090
. "${MODULE}" || continue
MODULE=${MODULE#${MODULESDIR}/}
MODULE=${MODULE%.sh}
@@ -414,8 +417,10 @@ _load_modules()
# Ensure our list is up to date
_gen_module_list false
+ # shellcheck disable=SC1090
if ! . "${MODULESLIST}"; then
_gen_module_list true
+ # shellcheck disable=SC1090
. "${MODULESLIST}"
fi
@@ -461,6 +466,7 @@ _load_modules()
MODULES="${MODULES}${MODULES:+ }${mod}"
# Now load and wrap our functions
+ # shellcheck disable=SC1090
if ! . "${MODULESDIR}/${mod}.sh"; then
eend 1 "${RC_SVCNAME}: error loading module \`${mod}'"
exit 1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: 5df0a442c2d33f80317d91ec3ce1933aa70acc52
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:27:33 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:36 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=5df0a442
init.d/net.lo.in: shellcheck: _run_if()
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 30ab7fd..e1a0cab 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -594,7 +594,7 @@ _run_if()
{
local cmd=$1 iface=$2 ifr=${IFACE} ifv=${IFVAR}
# Ensure that we don't stamp on real values
- local IFACE= IFVAR=
+ local IFACE='' IFVAR=''
shift
if [ -n "${iface}" ]; then
IFACE="${iface}"
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: ad3e0e73f5f9fbc8481dbee4f77fa8001ca78844
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:23:19 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:27 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=ad3e0e73
init.d/net.lo.in: shellcheck: _gen_module_list()
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 77f0d8f..961d9fa 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -300,11 +300,11 @@ _get_errorhandler_behavior() {
# Basically sorts our modules into order and saves the list
_gen_module_list()
{
- local x= f= force=$1
+ local x='' f='' force="$1"
if ! ${force} ; then
- if [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt /proc/$$/status ]; then
+ if [ -s "${MODULESLIST}" ] && [ "${MODULESLIST}" -nt /proc/$$/status ]; then
ewarn "Discarding cached module list ($MODULESLIST) as it's newer current time!"
- elif [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ]; then
+ elif [ -s "${MODULESLIST}" ] && [ "${MODULESLIST}" -nt "${MODULESDIR}" ]; then
local update=false
for x in "${MODULESDIR}"/*.sh; do
[ -e "${x}" ] || continue
@@ -333,7 +333,7 @@ _gen_module_list()
}
program() {
- if [ "$1" = "start" -o "$1" = "stop" ]; then
+ if [ "$1" = "start" ] || [ "$1" = "stop" ]; then
local s="$1"
shift
eval ${MODULE}_program_${s}="\"\${${MODULE}_program_${s}}\${${MODULE}_program_${s}:+ }$*\""
@@ -345,7 +345,7 @@ _gen_module_list()
provide() {
eval ${MODULE}_provide="\"\${${MODULE}_provide}\${${MODULE}_provide:+ }$*\""
local x
- for x in $*; do
+ for x in "$@"; do
eval ${x}_providedby="\"\${${MODULE}_providedby}\${${MODULE}_providedby:+ }${MODULE}\""
done
}
@@ -356,7 +356,7 @@ _gen_module_list()
. "${MODULE}" || continue
MODULE=${MODULE#${MODULESDIR}/}
MODULE=${MODULE%.sh}
- eval ${MODULE}_depend
+ eval "${MODULE}_depend"
MODULES="${MODULES} ${MODULE}"
done
@@ -402,13 +402,13 @@ _gen_module_list()
eval PROGRAM_START=\$${MODULE}_program_start
eval PROGRAM_STOP=\$${MODULE}_program_stop
eval PROVIDE=\$${MODULE}_provide
- echo "module_${i}='${MODULE}'" >> "${TMPMODULESLIST}"
- echo "module_${i}_program='${PROGRAM}'" >> "${TMPMODULESLIST}"
- echo "module_${i}_program_start='${PROGRAM_START}'" >> "${TMPMODULESLIST}"
- echo "module_${i}_program_stop='${PROGRAM_STOP}'" >> "${TMPMODULESLIST}"
- echo "module_${i}_provide='${PROVIDE}'" >> "${TMPMODULESLIST}"
+ echo "module_${i}='${MODULE}'"
+ echo "module_${i}_program='${PROGRAM}'"
+ echo "module_${i}_program_start='${PROGRAM_START}'"
+ echo "module_${i}_program_stop='${PROGRAM_STOP}'"
+ echo "module_${i}_provide='${PROVIDE}'"
: $(( i += 1 ))
- done
+ done >> "${TMPMODULESLIST}"
echo "module_${i}=" >> "${TMPMODULESLIST}"
mv -f "${TMPMODULESLIST}" "${MODULESLIST}"
)
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: b9b82d586cf03766f568b91156837d1b7861fb09
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:22:44 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:10 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=b9b82d58
init.d/net.lo.in: shellcheck: _which()
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 2999a96..77f0d8f 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -243,7 +243,7 @@ _which()
OIFS="$IFS"
IFS=:
for i in $PATH ; do
- [ -x $i/$1 ] && echo $i/$1 && break
+ [ -x "$i/$1" ] && echo "$i/$1" && break
done
IFS=$OIFS
}
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: b8ea3b8f78cb91cd48661ba81f3e261c5ff12f44
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:25:29 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:36 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=b8ea3b8f
init.d/net.lo.in: shellcheck: _load_config
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index c8af39f..30ab7fd 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -530,8 +530,9 @@ _load_modules()
_load_config()
{
- local config="$(_get_array "config_${IFVAR}")"
- local fallback="$(_get_array fallback_${IFVAR})"
+ local config='' fallback=''
+ config="$(_get_array "config_${IFVAR}")"
+ fallback="$(_get_array fallback_${IFVAR})"
config_index=0
local IFS="$__IFS"
@@ -545,7 +546,7 @@ _load_config()
# Of course, we may have a single address added old style.
# If the NEXT argument is a v4 or v6 address, it's the next config.
# Otherwise, it's arguments to the first config...
- if [ "${2#*.*}" = "${2}" -a "${2#*:*}" = "${2}" ]; then
+ if [ "${2#*.*}" = "${2}" ] && [ "${2#*:*}" = "${2}" ]; then
# Not an IPv4/IPv6
local IFS="$__IFS"
set -- ${config}
@@ -553,7 +554,7 @@ _load_config()
fi
# Ensure that loopback has the correct address
- if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
+ if [ "${IFACE}" = "lo" ] || [ "${IFACE}" = "lo0" ]; then
if [ "$1" != "null" ]; then
config_0="127.0.0.1/8"
config_index=1
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: c78662eeafaf5f9254f62ae1f40f7c058180af8a
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:24:46 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:35 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=c78662ee
init.d/net.lo.in: shellcheck: _load_modules
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index a958598..c8af39f 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -430,13 +430,13 @@ _load_modules()
fi
MODULES=
- if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
+ if [ "${IFACE}" != "lo" ] && [ "${IFACE}" != "lo0" ]; then
eval mymods=\$modules_${IFVAR}
# shellcheck disable=SC2154
[ -z "${mymods}" ] && mymods=${modules}
fi
- local i=-1 x= mod= f= provides=
+ local i=-1 x='' mod='' f='' provides=''
while true; do
: $(( i += 1 ))
eval mod=\$module_${i}
@@ -446,7 +446,7 @@ _load_modules()
eval set -- \$module_${i}_program
if [ -n "$1" ]; then
if ! _program_available "$@" >/dev/null; then
- vewarn "Skipping module $mod due to missing program: $@"
+ vewarn "Skipping module $mod due to missing program: $*"
continue
fi
fi
@@ -457,7 +457,7 @@ _load_modules()
fi
if [ -n "$1" ]; then
if ! _program_available "$@" >/dev/null; then
- vewarn "Skipping module $mod due to missing program: $@"
+ vewarn "Skipping module $mod due to missing program: $*"
continue
fi
fi
@@ -483,7 +483,8 @@ _load_modules()
# Wrap our provides
local f=
for f in pre_start start post_start; do
- eval "${provides}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }"
+ inner=$(command -v "${mod}_${f}")
+ eval "${provides}_${f}() { [ '${inner}' = '${mod}_${f}' ] || return 0; ${mod}_${f} \"\$@\"; }"
done
eval module_${mod}_provides="${provides}"
@@ -497,7 +498,8 @@ _load_modules()
eval x=\$module_${mod}_provides
[ -z "${x}" ] && continue
for f in pre_start start post_start; do
- eval "${x}_${f}() { [ "$(command -v "${mod}_${f}")" = "${mod}_${f}" ] || return 0; ${mod}_${f} \"\$@\"; }"
+ inner=$(command -v "${mod}_${f}")
+ eval "${x}_${f}() { [ '${inner}' = '${mod}_${f}' ] || return 0; ${mod}_${f} \"\$@\"; }"
done
eval module_${x}_providedby="${mod}"
;;
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: 5c989bfbac65b9f56c9a73c3380d8a735913cdf1
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:22:32 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:32:27 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=5c989bfb
init.d/net.lo.in: shellcheck: arrays
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index e49278f..c53d3ea 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -82,7 +82,7 @@ _array_helper()
_get_array()
{
- local _a=
+ local _a=''
if [ -n "${BASH}" ]; then
# shellcheck disable=SC2039
case "$(declare -p "$1" 2>/dev/null)" in
@@ -99,7 +99,7 @@ _get_array()
esac
fi
- _array_helper $1
+ _array_helper "$1"
}
# Flatten bash arrays to simple strings
@@ -122,7 +122,7 @@ _flatten_array()
esac
fi
- _array_helper $1
+ _array_helper "$1"
}
_wait_for_presence()
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: a7e4efa284da47d89bd05f8a328b8a7b5edd2ad6
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:22:41 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:32:43 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=a7e4efa2
init.d/net.lo.in: shellcheck: quick initial variable values
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index c53d3ea..2999a96 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -203,7 +203,7 @@ _netmask2cidr()
;;
esac
- local i= len=
+ local i='' len=''
local IFS=.
for i in $1; do
case $i in
@@ -220,7 +220,7 @@ _netmask2cidr()
_configure_variables()
{
- local var= v= t=
+ local var='' v='' t=''
for var in ${_config_vars}; do
local v=
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: d3780ab87ea78da725012deda8a2e866b6276603
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:21:59 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:31:46 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=d3780ab8
init.d/net.lo.in: shellcheck: toplevel INIT variable
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 1e5de3c..6d6b581 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -18,7 +18,7 @@ __IFS="
"
# Set the INIT to be openrc if this file is called directly
-: ${INIT:=openrc}
+: "${INIT:=openrc}"
if [ -f "$SHDIR/functions.sh" ]; then
# shellcheck disable=SC1090
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: 1ae3f8e257032e753713b6582e23121984c0f9fa
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:28:15 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:40 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=1ae3f8e2
init.d/net.lo.in: shellcheck: start()
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index e1a0cab..9ba2e03 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -632,9 +632,17 @@ is_interface_type()
start()
{
- local IFACE=$(get_interface) oneworked=false fallback=false module=
- local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
- local metric=0 _up_before_preup
+ local IFACE=''
+ local IFVAR=''
+ local oneworked=false
+ local fallback=false
+ local module=''
+ local cmd=''
+ local our_metric=''
+ local metric=0
+ local _up_before_preup=''
+ IFACE=$(get_interface)
+ IFVAR=$(shell_var "${IFACE}")
eval _up_before_preup="\$up_before_preup_${IFVAR}"
# shellcheck disable=SC2154
[ -z "${_up_before_preup}" ] && _up_before_preup=$up_before_preup
@@ -682,14 +690,14 @@ start()
return 1
fi
- local config= config_index=
+ local config='' config_index=''
_load_config
config_index=0
eval our_metric=\$metric_${IFVAR}
if [ -n "${our_metric}" ]; then
metric=${our_metric}
- elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
+ elif [ "${IFACE}" != "lo" ] && [ "${IFACE}" != "lo0" ]; then
: $(( metric += $(_ifindex) ))
fi
@@ -698,7 +706,7 @@ start()
[ -z "${config}" ] && break
set -- ${config}
- if [ "$1" != "null" -a "$1" != "noop" ]; then
+ if [ "$1" != "null" ] && [ "$1" != "noop" ]; then
ebegin "$1"
fi
eindent
@@ -754,7 +762,7 @@ start()
if [ -z "${routes}" ]; then
routes="$(_get_array "routes_${IFVAR}")"
fi
- if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
+ if [ "${IFACE}" = "lo" ] || [ "${IFACE}" = "lo0" ]; then
if [ "${config_0}" != "null" ]; then
routes="127.0.0.0/8 via 127.0.0.1
${routes}"
@@ -780,11 +788,11 @@ ${routes}"
ebegin ${cmd}
# Work out if we're a host or a net if not told
case ${cmd} in
- -net" "*|-host" "*);;
- *" "netmask" "*) cmd="-net ${cmd}";;
+ -net\ *|-host\ *);;
+ *\ netmask\ *) cmd="-net ${cmd}";;
*.*.*.*/32*) cmd="-host ${cmd}";;
- *.*.*.*/*|0.0.0.0|0.0.0.0" "*) cmd="-net ${cmd}";;
- default|default" "*) cmd="-net ${cmd}";;
+ *.*.*.*/*|0.0.0.0|0.0.0.0\ *) cmd="-net ${cmd}";;
+ default|default\ *) cmd="-net ${cmd}";;
*:*/128*) cmd="-host ${cmd}";;
*:*/*) cmd="-net ${cmd}";;
*) cmd="-host ${cmd}";;
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: abcc0bd4c372e36cc6e5e46832e7664a72b6bcaa
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:22:09 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:32:11 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=abcc0bd4
init.d/net.lo.in: shellcheck: depend()
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 6d6b581..e49278f 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -34,10 +34,11 @@ MODULESLIST="${RC_SVCDIR}/nettree$(get_interface)"
depend()
{
- local IFACE=$(get_interface)
- local IFVAR=$(shell_var "${IFACE}")
+ local IFACE IFVAR
+ IFACE=$(get_interface)
+ IFVAR=$(shell_var "${IFACE}")
- if [ "$RC_UNAME" = Linux -a "$IFACE" != lo ]; then
+ if [ "$RC_UNAME" = Linux ] && [ "$IFACE" != lo ]; then
need sysfs
after modules
fi
@@ -54,14 +55,14 @@ depend()
esac
if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then
- depend_${IFVAR}
+ "depend_${IFVAR}"
fi
- local dep= prov=
+ local dep prov
for dep in need use before after provide keyword; do
eval prov=\$rc_${dep}_${IFVAR}
if [ -n "${prov}" ]; then
- ${dep} ${prov}
+ "${dep}" "${prov}"
ewarn "rc_${dep}_${IFVAR} is deprecated."
ewarn "Please use rc_net_${IFVAR}_${dep} instead."
fi
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: b7e61844bd3d66f61ce9967df78a5d30f3be8d00
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:28:33 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:44 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=b7e61844
init.d/net.lo.in: shellcheck: stop()
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 9ba2e03..a5ac0fe 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -830,14 +830,16 @@ stop()
# correctly if we go back to multiuser.
yesno ${keep_network:-YES} && yesno $RC_GOINGDOWN && return 0
- local IFACE=$(get_interface) module=
- local IFVAR=$(shell_var "${IFACE}") opts=
+ local IFACE='' module=''
+ local IFVAR=''
+ IFACE=$(get_interface)
+ IFVAR=$(shell_var "${IFACE}")
einfo "Bringing down interface ${IFACE}"
eindent
if [ -z "${MODULES}" ]; then
- local MODULES=
+ local MODULES=''
_load_modules false
fi
@@ -883,7 +885,7 @@ stop()
# If not in background, and not loopback then bring the interface down
# unless overridden.
if ! yesno ${IN_BACKGROUND} && \
- [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
+ [ "${IFACE}" != "lo" ] && [ "${IFACE}" != "lo0" ]; then
eval module=\$ifdown_${IFVAR}
module=${module:-${ifdown:-YES}}
yesno ${module} && _down 2>/dev/null
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2019-04-21 5:34 Robin H. Johnson
0 siblings, 0 replies; 31+ messages in thread
From: Robin H. Johnson @ 2019-04-21 5:34 UTC (permalink / raw
To: gentoo-commits
commit: c88734624727231da02a3f610c9af0fda70fc1d0
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 21 05:23:22 2019 +0000
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Sun Apr 21 05:33:35 2019 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=c8873462
init.d/net.lo.in: shellcheck: PROVIDEDBY MODULE trample
This is a logic error caught by shellcheck. The nested loops used the
same index variable, so the outer loop progress could get trampled.
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>
init.d/net.lo.in | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 961d9fa..a958598 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -369,14 +369,14 @@ _gen_module_list()
VISITED="${VISITED} $1"
eval AFTER=\$${1}_after
- for MODULE in ${AFTER}; do
- eval PROVIDEDBY=\$${MODULE}_providedby
+ for MODULE1 in ${AFTER}; do
+ eval PROVIDEDBY=\$${MODULE1}_providedby
if [ -n "${PROVIDEDBY}" ]; then
- for MODULE in ${PROVIDEDBY}; do
- visit "${MODULE}"
+ for MODULE2 in ${PROVIDEDBY}; do
+ visit "${MODULE2}"
done
else
- visit "${MODULE}"
+ visit "${MODULE1}"
fi
done
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2020-09-07 13:03 Lars Wendler
0 siblings, 0 replies; 31+ messages in thread
From: Lars Wendler @ 2020-09-07 13:03 UTC (permalink / raw
To: gentoo-commits
commit: 26aa22cc703d5ec0da2d78f042ad3bb9c42afb6a
Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 7 08:55:10 2020 +0000
Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
CommitDate: Mon Sep 7 13:02:58 2020 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=26aa22cc
init.d/net.lo.in: Add missing closing function bracket
Bug introdcued with commit d3b5d78c5f3696aaf841d7900e69a37de29cfc25
Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
init.d/net.lo.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 3ab83b2..fb55788 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -295,6 +295,7 @@ _get_errorhandler_behavior() {
echo "$value" && break
fi
done
+}
_show_address6()
{
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2021-03-31 1:11 Patrick McLean
0 siblings, 0 replies; 31+ messages in thread
From: Patrick McLean @ 2021-03-31 1:11 UTC (permalink / raw
To: gentoo-commits
commit: bef5edf9d2d1fcd982ae19a7cb05dc2d58b854e7
Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 31 01:06:31 2021 +0000
Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Wed Mar 31 01:10:48 2021 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=bef5edf9
net.lo.in: quote variables in _configure_variables
The variables being passed to eval aren't quoted either in the before-eval
scope, or in what is passed to eval. Make sure they are quoted.
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>
init.d/net.lo.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 06304e1..0bb69f3 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -225,9 +225,9 @@ _configure_variables()
for var in ${_config_vars}; do
local v=
for t; do
- eval v=\$${var}_${t}
+ eval v="\"\$${var}_${t}\""
if [ -n "${v}" ]; then
- eval ${var}_${IFVAR}=\$${var}_${t}
+ eval "${var}_${IFVAR}=\"\$${var}_${t}\""
continue 2
fi
done
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [gentoo-commits] proj/netifrc:master commit in: init.d/
@ 2024-01-07 9:42 Sam James
0 siblings, 0 replies; 31+ messages in thread
From: Sam James @ 2024-01-07 9:42 UTC (permalink / raw
To: gentoo-commits
commit: 6b54da4cc0b85aaed4e4546bbb0893476fb6835c
Author: Matoro Mahri <matoro_gentoo <AT> matoro <DOT> tk>
AuthorDate: Wed Jan 3 15:37:03 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 7 09:42:33 2024 +0000
URL: https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=6b54da4c
net.lo.in: replace "type" bashism with "command"
Closes: https://bugs.gentoo.org/844178
Signed-off-by: Matoro Mahri <matoro_gentoo <AT> matoro.tk>
Closes: https://github.com/gentoo/netifrc/pull/50
Signed-off-by: Sam James <sam <AT> gentoo.org>
init.d/net.lo.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 0bb69f3..afba99f 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -902,7 +902,7 @@ stop()
yesno ${module} && _down 2>/dev/null
fi
- type resolvconf >/dev/null 2>&1 && resolvconf -d "${IFACE}" 2>/dev/null
+ command -v resolvconf >/dev/null && resolvconf -d "${IFACE}" 2>/dev/null
if [ "$(command -v "postdown")" = "postdown" ]; then
ebegin "Running postdown"
^ permalink raw reply related [flat|nested] 31+ messages in thread
end of thread, other threads:[~2024-01-07 9:42 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-21 5:34 [gentoo-commits] proj/netifrc:master commit in: init.d/ Robin H. Johnson
-- strict thread matches above, loose matches on Subject: below --
2024-01-07 9:42 Sam James
2021-03-31 1:11 Patrick McLean
2020-09-07 13:03 Lars Wendler
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2019-04-21 5:34 Robin H. Johnson
2017-11-14 20:48 Robin H. Johnson
2017-11-14 20:48 Robin H. Johnson
2016-10-24 20:52 Robin H. Johnson
2016-10-24 0:23 Robin H. Johnson
2016-10-24 0:23 Robin H. Johnson
2016-10-23 23:50 Robin H. Johnson
2016-07-05 18:13 Robin H. Johnson
2015-11-08 14:30 Robin H. Johnson
2015-11-08 14:30 Robin H. Johnson
2015-05-25 10:04 Mike Frysinger
2015-05-25 10:01 Mike Frysinger
2015-01-09 17:17 Robin H. Johnson
2014-10-11 19:47 Robin H. Johnson
2014-07-17 17:56 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