#!/bin/sh
# Probe the same candidate order USBIP_CANDIDATE_PATHS uses in
# privileged_helper.rs (/usr/bin first, then /usr/sbin for Fedora) before
# falling back to a PATH lookup. A command -v-only fallback of "/usr/bin/usbip"
# is wrong on Fedora, where usbip lives at /usr/sbin - the exact distro this
# wrapper exists to support.
for candidate in /usr/bin/usbip /usr/sbin/usbip; do
    [ -x "$candidate" ] && exec "$candidate" "$@"
done
exec "$(command -v usbip)" "$@"
