Browse Source

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>
master
Américo Wang 14 years ago committed by Harald Hoyer
parent
commit
4a855e6beb
  1. 14
      modules.d/05busybox/module-setup.sh

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

@ -15,22 +15,22 @@ depends() {
install() { install() {
local _i _progs _path local _i _progs _path
inst busybox /usr/bin/busybox inst busybox /usr/bin/busybox

for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
# List of shell programs that we use in other official dracut modules, that do
# must be supported by the busybox installed on the host system _progs="$_progs $_i"
_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" done


# FIXME: switch_root should be in the above list, but busybox version hangs # 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) # (using busybox-1.15.1-7.fc14.i686 at the time of writing)


for _i in $_progs; do for _i in $_progs; do
_path=$(find_binary "$_i") _path=$(find_binary "$_i")
[ -z "$_path" ] && continue
if [[ $_path != ${_path#/usr} ]]; then if [[ $_path != ${_path#/usr} ]]; then
ln -s ../../usr/bin/busybox "$initdir/$_path" ln -sf ../../usr/bin/busybox "$initdir/$_path"
else else
ln -s ../usr/bin/busybox "$initdir/$_path" ln -sf ../usr/bin/busybox "$initdir/$_path"
fi fi
done done

} }



Loading…
Cancel
Save