Since mkinitcpio rewrites its runtime config, we can guarantee that
these variable are sanitized of extraneous whitespace. Meld the two
calls together, ensuring that we retain the ordering, but only call
modprobe once.

Signed-off-by: Dave Reisner <[email protected]>
---
 init | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/init b/init
index b95565d..3351cfc 100644
--- a/init
+++ b/init
@@ -24,8 +24,9 @@ done
 
 run_hookfunctions 'run_earlyhook' 'early hook' $EARLYHOOKS
 
-[ -n "${earlymodules//[[:space:]]}" ] && modprobe -qab ${earlymodules//,/ }
-[ -n "${MODULES//[[:space:]]}" ] && modprobe -qab $MODULES
+if [ -n "$earlymodules$MODULES" ]; then
+    modprobe -qab ${earlymodules//,/ } $MODULES
+fi
 
 # If rootdelay is empty or not a non-negative integer, set it to 10
 if [ -z "${rootdelay}" ] || ! [ "${rootdelay}" -ge 0 ]; then
-- 
1.8.0

Reply via email to