]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
busybox: simplify listing of supported utilities
authorAlexander Tsoy <alexander@tsoy.me>
Mon, 25 May 2020 14:49:20 +0000 (17:49 +0300)
committerHarald Hoyer <harald@hoyer.xyz>
Fri, 29 May 2020 08:27:59 +0000 (10:27 +0200)
'--list' option is supported since busybox-1.20.0, which was released
in 2010.

modules.d/05busybox/module-setup.sh

index ecbd6a13f5ecf5279ff2ea993239153fbb646d60..5d88c5d140cb1863c7e591a826b0b760359e37ec 100755 (executable)
@@ -14,15 +14,16 @@ depends() {
 
 # called by dracut
 install() {
-    local _i _progs _path _busybox
+    local _i _path _busybox
+    local _progs=()
     _busybox=$(type -P busybox)
     inst $_busybox /usr/bin/busybox
-    for _i in $($_busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}')
-    do
-        _progs="$_progs $_i"
+    for _i in $($_busybox --list); do
+        [[ ${_i} == busybox ]] && continue
+        _progs+=("${_i}")
     done
 
-    for _i in $_progs; do
+    for _i in "${_progs[@]}"; do
         _path=$(find_binary "$_i")
         [ -z "$_path" ] && continue
         ln_r /usr/bin/busybox $_path