summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2015-09-10 10:57:55 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2015-09-10 10:57:55 -0500
commitee95471d2c09f373b0b0683e40cd0e1f1a4904ac (patch)
tree2866f99ea58798f2636b0f82253fc3f951117ae0
parentfix indentation (diff)
downloadudev-gentoo-scripts-ee95471d2c09f373b0b0683e40cd0e1f1a4904ac.tar.gz
udev-gentoo-scripts-ee95471d2c09f373b0b0683e40cd0e1f1a4904ac.tar.bz2
udev-gentoo-scripts-ee95471d2c09f373b0b0683e40cd0e1f1a4904ac.zip
udev: create a function to locate the binary
-rw-r--r--init.d/udev27
1 files changed, 16 insertions, 11 deletions
diff --git a/init.d/udev b/init.d/udev
index f286ad8..8106a20 100644
--- a/init.d/udev
+++ b/init.d/udev
@@ -14,6 +14,19 @@ depend()
keyword -lxc -systemd-nspawn -vserver
}
+get_udevd_binary() {
+ bins="/sbin/udevd /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd"
+ for f in ${bins}; do
+ if [ -x "$f" -a ! -L "$f" ]; then
+ command="$f"
+ fi
+ done
+ if [ -z "$command" ]; then
+ eerror "Unable to find udev executable."
+ return 1
+ fi
+}
+
start_pre()
{
# make sure devtmpfs is in the kernel
@@ -45,16 +58,7 @@ start_pre()
fi
fi
- bins="/sbin/udevd /lib/systemd/systemd-udevd /usr/lib/systemd/systemd-udevd"
- for f in ${bins}; do
- if [ -x "$f" -a ! -L "$f" ]; then
- command="$f"
- fi
- done
- if [ -z "$command" ]; then
- eerror "Unable to find udev executable."
- return 1
- fi
+ get_udevd_binary || return 1
if [ -e /proc/sys/kernel/hotplug ]; then
echo "" >/proc/sys/kernel/hotplug
@@ -75,8 +79,9 @@ stop()
rc=$?
if [ $rc -ne 0 ]; then
eend $rc "Failed to stop $RC_SVCNAME using udevadm"
+ get_udevd_binary || return 1
ebegin "Trying with start-stop-daemon"
- start-stop-daemon --stop --exec /sbin/udevd
+ start-stop-daemon --stop --exec ${command}
rc=$?
fi
eend $rc "Failed to stop $RC_SVCNAME"