diff --git a/packages/sysutils/busybox/scripts/init b/packages/sysutils/busybox/scripts/init index 42a88ee913..c0b2d12db6 100755 --- a/packages/sysutils/busybox/scripts/init +++ b/packages/sysutils/busybox/scripts/init @@ -80,6 +80,7 @@ case $boot in CIFS=*|SMB=*|ISCSI=*|NBD=*|NFS=*) UPDATE_DISABLED=yes + FLASH_NETBOOT=yes ;; esac ;; @@ -94,9 +95,6 @@ wol_mac=*) wol_mac="${arg#*=}" ;; - wol_ip=*) - wol_ip="${arg#*=}" - ;; wol_wait=*) wol_wait="${arg#*=}" ;; @@ -415,22 +413,40 @@ fi } + wakeonlan() { + if [ "$STORAGE_NETBOOT" = "yes" ]; then + wol_ip=${disk%:*} + wol_ip=${wol_ip#*=} + elif [ "$FLASH_NETBOOT" = "yes" ]; then + wol_ip=${boot%:*} + wol_ip=${wol_ip#*=} + else + return 0 + fi + + if [ -n "$wol_ip" -a -n "$wol_mac" -a -n "$wol_wait" ]; then + progress "Sending Magic Packet (WOL) if needed" + + if ! ping -q -c 2 "$wol_ip" &>/dev/null; then + ether-wake "$wol_mac" + sleep "$wol_wait" + fi + fi + } + mount_flash() { progress "Mounting flash" + wakeonlan + mount_part "$boot" "/flash" "ro,noatime" } - mount_storage() { - if [ -n "$wol_ip" ] && [ -n "$wol_mac" ] && [ -n "$wol_wait" ]; then - if ! (/bin/busybox ping -q -c 2 "$wol_ip" > /dev/null 2>&1); then - /bin/busybox ether-wake "$wol_mac" - /bin/busybox sleep "$wol_wait" - fi - fi - + mount_storage() { progress "Mounting storage" + wakeonlan + if [ -n "$disk" ]; then if [ -n "$OVERLAY" ]; then OVERLAY_DIR=`cat /sys/class/net/eth0/address | tr -d :`