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
This commit is contained in:
JUN JIE NAN 2013-12-04 17:45:18 +08:00
parent d7e43c0861
commit a85f4d11f7

View File

@ -152,7 +152,7 @@ function populate_lib () {
for i in "$BUSYBOX" bash lsmod modprobe udevadm \ for i in "$BUSYBOX" bash lsmod modprobe udevadm \
wget reboot shutdown $UDEVD $UDEV_FIRMWARE \ wget reboot shutdown $UDEVD $UDEV_FIRMWARE \
$(cat /etc/dib_binary_deps) ; do $(cat /etc/dib_binary_deps) ; do
if "$BUSYBOX" --list | grep "^$i\$" >/dev/null; then if busybox_list | grep "^$i\$" >/dev/null; then
continue continue
fi fi
path=`which $i 2>/dev/null` || path=$i path=`which $i 2>/dev/null` || path=$i
@ -170,10 +170,18 @@ function populate_lib () {
cp -a "$FIRMWARE_DIR" "$TMP_MOUNT_PATH/lib/firmware" 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 () { function populate_busybox () {
echo "Creating symlinks for busybox binaries" 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 if [ -f "$TMP_MOUNT_PATH/bin/$i" ]; then
echo "skip $i" echo "skip $i"
continue continue