Merge "Fix no busybox symlinks issue on rhel"

This commit is contained in:
Jenkins 2013-12-05 12:24:57 +00:00 committed by Gerrit Code Review
commit 004bc7e33a

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