Harald Hoyer 308914
From 50cc23ba32b0fda63eff7623b529dbeb4e6a38c6 Mon Sep 17 00:00:00 2001
Harald Hoyer 308914
From: Alexander Tsoy <alexander@tsoy.me>
Harald Hoyer 308914
Date: Mon, 25 May 2020 17:49:20 +0300
Harald Hoyer 308914
Subject: [PATCH] busybox: simplify listing of supported utilities
Harald Hoyer 308914
Harald Hoyer 308914
'--list' option is supported since busybox-1.20.0, which was released
Harald Hoyer 308914
in 2010.
Harald Hoyer 308914
---
Harald Hoyer 308914
 modules.d/05busybox/module-setup.sh | 11 ++++++-----
Harald Hoyer 308914
 1 file changed, 6 insertions(+), 5 deletions(-)
Harald Hoyer 308914
Harald Hoyer 308914
diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
Harald Hoyer 308914
index ecbd6a13..5d88c5d1 100755
Harald Hoyer 308914
--- a/modules.d/05busybox/module-setup.sh
Harald Hoyer 308914
+++ b/modules.d/05busybox/module-setup.sh
Harald Hoyer 308914
@@ -14,15 +14,16 @@ depends() {
Harald Hoyer 308914
 
Harald Hoyer 308914
 # called by dracut
Harald Hoyer 308914
 install() {
Harald Hoyer 308914
-    local _i _progs _path _busybox
Harald Hoyer 308914
+    local _i _path _busybox
Harald Hoyer 308914
+    local _progs=()
Harald Hoyer 308914
     _busybox=$(type -P busybox)
Harald Hoyer 308914
     inst $_busybox /usr/bin/busybox
Harald Hoyer 308914
-    for _i in $($_busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}')
Harald Hoyer 308914
-    do
Harald Hoyer 308914
-        _progs="$_progs $_i"
Harald Hoyer 308914
+    for _i in $($_busybox --list); do
Harald Hoyer 308914
+        [[ ${_i} == busybox ]] && continue
Harald Hoyer 308914
+        _progs+=("${_i}")
Harald Hoyer 308914
     done
Harald Hoyer 308914
 
Harald Hoyer 308914
-    for _i in $_progs; do
Harald Hoyer 308914
+    for _i in "${_progs[@]}"; do
Harald Hoyer 308914
         _path=$(find_binary "$_i")
Harald Hoyer 308914
         [ -z "$_path" ] && continue
Harald Hoyer 308914
         ln_r /usr/bin/busybox $_path
Harald Hoyer 308914