public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/netifrc:master commit in: init.d/
Date: Sun, 21 Apr 2019 05:34:03 +0000 (UTC)	[thread overview]
Message-ID: <1555824807.ad3e0e73f5f9fbc8481dbee4f77fa8001ca78844.robbat2@OpenRC> (raw)

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}"
 	)


             reply	other threads:[~2019-04-21  5:34 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-21  5:34 Robin H. Johnson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-01-07  9:42 [gentoo-commits] proj/netifrc:master commit in: init.d/ 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1555824807.ad3e0e73f5f9fbc8481dbee4f77fa8001ca78844.robbat2@OpenRC \
    --to=robbat2@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox