From a85f4d11f71fb7f05db591f55e456d3f1b427ac3 Mon Sep 17 00:00:00 2001 From: JUN JIE NAN Date: Wed, 4 Dec 2013 17:45:18 +0800 Subject: [PATCH] Fix no busybox symlinks issue on rhel busybox on rhel has no `--list' option, which cause populate_busybox can not create busybox symlinks. So the ramdisk created will not work totally. Fixes bug #1257669 Change-Id: I4f905673bb577867c99e0ccc0756c56a292474f5 --- lib/ramdisk-functions | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ramdisk-functions b/lib/ramdisk-functions index 78d4376a..3646585d 100644 --- a/lib/ramdisk-functions +++ b/lib/ramdisk-functions @@ -152,7 +152,7 @@ function populate_lib () { for i in "$BUSYBOX" bash lsmod modprobe udevadm \ wget reboot shutdown $UDEVD $UDEV_FIRMWARE \ $(cat /etc/dib_binary_deps) ; do - if "$BUSYBOX" --list | grep "^$i\$" >/dev/null; then + if busybox_list | grep "^$i\$" >/dev/null; then continue fi path=`which $i 2>/dev/null` || path=$i @@ -170,10 +170,18 @@ function populate_lib () { cp -a "$FIRMWARE_DIR" "$TMP_MOUNT_PATH/lib/firmware" } +function busybox_list () { + # busybox supports --list option since version 1.18 + "$BUSYBOX" --list 2> /dev/null && return + # for busybox under 1.18 we parse command list from --help output + scrlet='{ if (go) { print } } /Currently defined functions:/ { go=1 }' + "$BUSYBOX" --help | awk "$scrlet" | tr ',' '\n' | xargs -n1 echo +} + function populate_busybox () { echo "Creating symlinks for busybox binaries" - for i in $( "$BUSYBOX" --list ); do + for i in $( busybox_list ); do if [ -f "$TMP_MOUNT_PATH/bin/$i" ]; then echo "skip $i" continue