Blame 0015-busybox-module-parse-busybox-defined-functions-dynam.patch

Harald Hoyer 428fde
From 4a855e6bebed956c108865823bcc131ebea2841a Mon Sep 17 00:00:00 2001
Harald Hoyer 428fde
From: =?UTF-8?q?Am=C3=A9rico=20Wang?= <xiyou.wangcong@gmail.com>
Harald Hoyer 428fde
Date: Thu, 21 Jul 2011 15:33:19 +0800
Harald Hoyer 428fde
Subject: [PATCH] busybox module: parse busybox defined functions dynamically
Harald Hoyer 428fde
Harald Hoyer 428fde
Currently in dracut busybox module, we hard-code the list of binaries
Harald Hoyer 428fde
available in busybox. Actually we can get this list by running busybox
Harald Hoyer 428fde
without any arguments.
Harald Hoyer 428fde
Harald Hoyer 428fde
Also, if find_binary() finds nothing, we would symlink $initdir/
Harald Hoyer 428fde
which is not we expect.
Harald Hoyer 428fde
Harald Hoyer 428fde
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Harald Hoyer 428fde
---
Harald Hoyer 428fde
 modules.d/05busybox/module-setup.sh |   16 ++++++++--------
Harald Hoyer 428fde
 1 files changed, 8 insertions(+), 8 deletions(-)
Harald Hoyer 428fde
Harald Hoyer 428fde
diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
Harald Hoyer 428fde
index 5ef03ef..2e9ead8 100755
Harald Hoyer 428fde
--- a/modules.d/05busybox/module-setup.sh
Harald Hoyer 428fde
+++ b/modules.d/05busybox/module-setup.sh
Harald Hoyer 428fde
@@ -15,22 +15,22 @@ depends() {
Harald Hoyer 428fde
 install() {
Harald Hoyer 428fde
     local _i _progs _path
Harald Hoyer 428fde
     inst busybox /usr/bin/busybox
Harald Hoyer 428fde
-
Harald Hoyer 428fde
-    # List of shell programs that we use in other official dracut modules, that
Harald Hoyer 428fde
-    # must be supported by the busybox installed on the host system
Harald Hoyer 428fde
-    _progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
Harald Hoyer 428fde
+    for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
Harald Hoyer 428fde
+    do
Harald Hoyer 428fde
+        _progs="$_progs $_i"
Harald Hoyer 428fde
+    done
Harald Hoyer 428fde
 
Harald Hoyer 428fde
     # FIXME: switch_root should be in the above list, but busybox version hangs
Harald Hoyer 428fde
     # (using busybox-1.15.1-7.fc14.i686 at the time of writing)
Harald Hoyer 428fde
 
Harald Hoyer 428fde
     for _i in $_progs; do
Harald Hoyer 428fde
-	_path=$(find_binary "$_i")
Harald Hoyer 428fde
+        _path=$(find_binary "$_i")
Harald Hoyer 428fde
+        [ -z "$_path" ] && continue
Harald Hoyer 428fde
         if [[ $_path != ${_path#/usr} ]]; then
Harald Hoyer 428fde
-    	    ln -s ../../usr/bin/busybox "$initdir/$_path"
Harald Hoyer 428fde
+            ln -sf ../../usr/bin/busybox "$initdir/$_path"
Harald Hoyer 428fde
         else
Harald Hoyer 428fde
-            ln -s ../usr/bin/busybox "$initdir/$_path"
Harald Hoyer 428fde
+            ln -sf ../usr/bin/busybox "$initdir/$_path"
Harald Hoyer 428fde
         fi
Harald Hoyer 428fde
     done
Harald Hoyer 428fde
-
Harald Hoyer 428fde
 }
Harald Hoyer 428fde