xpp_fxloader: Also look for udevadm in /bin
authorTzafrir Cohen <tzafrir@debian.org>
Wed, 25 Jan 2017 15:55:30 +0000 (17:55 +0200)
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>
Mon, 26 Jun 2017 14:01:01 +0000 (17:01 +0300)
* udevadm is being moved to /bin. /sbin/udevadm will remain as a
  compatibility symlink.
* xpp_fxloader should also look for /bin/udevadm in addition to
  /sbin/udevadm and /sbin/udevsettle
* Reverse the order: look for newer ones first.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>

xpp/astribank_hook

index fdfa82a..3b5a6fb 100755 (executable)
@@ -94,22 +94,27 @@ wait_for_udev() {
        UDEV_SETTLE_MAX_TIME=10
 
        echo "Waiting for udev to settle down..."
-       if [ -x /sbin/udevsettle ]; then
-               # Old system, stand-alone udevsettle command
-               /sbin/udevsettle --timeout="$UDEV_SETTLE_MAX_TIME"
+       udevsettle_cmd=
+       if [ -x /bin/udevadm ]; then
+               udevsettle_cmd="/bin/udevadm settle"
        elif [ -x /sbin/udevadm ]; then
-               # Assume modern system, udevadm has settle parameter
-               if ! /sbin/udevadm settle --timeout="$UDEV_SETTLE_MAX_TIME"
-               then
-                       echo "udevadm failed ($?)."
-                       echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
-                       sleep "$UDEV_SETTLE_MAX_TIME"
-               fi
+               udevsettle_cmd="/sbin/udevadm settle"
+       elif [ -x /sbin/udevsettle ]; then
+               udevsettle_cmd="/sbin/udevsettle"
        else
                echo "No udevsettle/udevadm."
                echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
                sleep "$UDEV_SETTLE_MAX_TIME"
+               return
+       fi
+
+       if ! $udevsettle_cmd --timeout="$UDEV_SETTLE_MAX_TIME"
+       then
+               echo "udevadm failed ($?)."
+               echo "Fallback to sleep $UDEV_SETTLE_MAX_TIME seconds."
+               sleep "$UDEV_SETTLE_MAX_TIME"
        fi
+
        sleep 1 # Wait a bit more (races)
 }