Files
xen/tools/check/check_udev
T
kfraser@localhost.localdomain 54ca5bdead Fix udev check.
Quiesce 'which' invocation, and allow expanding variables in error
message.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
2007-01-12 14:32:41 +00:00

35 lines
556 B
Bash
Executable File

#!/bin/sh
# CHECK-INSTALL
RC=0
case ${OS} in
OpenBSD|NetBSD|FreeBSD)
TOOL="vnconfig"
which ${TOOL} 1>/dev/null 2>&1 || RC=1
;;
Linux)
TOOL="udevinfo"
UDEV_VERSION="0"
test -x "$(which ${TOOL} 2>/dev/null)" && \
UDEV_VERSION=$(${TOOL} -V | sed -e 's/^[^0-9]* \([0-9]\{1,\}\)[^0-9]\{0,\}/\1/')
if test "${UDEV_VERSION}" -ge 059; then
RC=0
else
TOOL="hotplug"
which ${TOOL} 1>/dev/null 2>&1 || RC=1
fi
;;
*)
TOOL=""
echo "Unknown OS" && RC=1
;;
esac
if test ${RC} -ne 0; then
echo
echo " *** Check for ${TOOL} FAILED"
fi
exit ${RC}