mkinitrd unification across distributions
 help / color / mirror / Atom feed
* [Patch] busybox module: parse busybox defined functions dynamically
@ 2011-07-21  7:33 Américo Wang
       [not found] ` <CAM_iQpWn9SMU8NXKd-XzdXX7WZv3ba6swRcf2yYTwEJvGHN35w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Américo Wang @ 2011-07-21  7:33 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 337 bytes --]

Currently in dracut busybox module, we hard-code the list of binaries
available in busybox. Actually we can get this list by running busybox
without any arguments.

Also, if find_binary() finds nothing, we would symlink $initdir/
which is not we expect.

Signed-off-by: WANG Cong <xiyou.wangcong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

[-- Attachment #2: dracut-busybox.diff --]
[-- Type: text/x-patch, Size: 1432 bytes --]

diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
index 5ef03ef..32b5458 100755
--- a/modules.d/05busybox/module-setup.sh
+++ b/modules.d/05busybox/module-setup.sh
@@ -15,22 +15,22 @@ depends() {
 install() {
     local _i _progs _path
     inst busybox /usr/bin/busybox
-
-    # List of shell programs that we use in other official dracut modules, that
-    # must be supported by the busybox installed on the host system
-    _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"
+    for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
+    do
+        _progs="$_progs $_i"
+    done
 
     # FIXME: switch_root should be in the above list, but busybox version hangs
     # (using busybox-1.15.1-7.fc14.i686 at the time of writing)
 
     for _i in $_progs; do
 	_path=$(find_binary "$_i")
+        [ -z "$_path" ] && continue
         if [[ $_path != ${_path#/usr} ]]; then
-    	    ln -s ../../usr/bin/busybox "$initdir/$_path"
+            ln -sf ../../usr/bin/busybox "$initdir/$_path"
         else
-            ln -s ../usr/bin/busybox "$initdir/$_path"
+            ln -sf ../usr/bin/busybox "$initdir/$_path"
         fi
     done
-
 }
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-07-21  8:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-21  7:33 [Patch] busybox module: parse busybox defined functions dynamically Américo Wang
     [not found] ` <CAM_iQpWn9SMU8NXKd-XzdXX7WZv3ba6swRcf2yYTwEJvGHN35w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-21  7:36   ` Américo Wang
2011-07-21  8:01   ` Harald Hoyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox