dracut/0015-busybox-module-parse-busybox-defined-functions-dynam.patch

53 lines
2.1 KiB
Diff
Raw Normal View History

From 4a855e6bebed956c108865823bcc131ebea2841a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Am=C3=A9rico=20Wang?= <xiyou.wangcong@gmail.com>
Date: Thu, 21 Jul 2011 15:33:19 +0800
Subject: [PATCH] busybox module: parse busybox defined functions dynamically
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@gmail.com>
---
modules.d/05busybox/module-setup.sh | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/modules.d/05busybox/module-setup.sh b/modules.d/05busybox/module-setup.sh
index 5ef03ef..2e9ead8 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")
+ _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
-
}