diff --git a/templates/udev/INSTALL b/templates/udev/INSTALL new file mode 100644 index 00000000000..0b782c3b863 --- /dev/null +++ b/templates/udev/INSTALL @@ -0,0 +1,20 @@ +# +# This script registers the udev service into the +# 'sysinit' runlevel, as required by OpenRC. +# + +case "${ACTION}" in +pre) + ;; +post) + [ ! -x sbin/rc-update ] && exit 0 + [ ! -x sbin/rc-service ] && exit 0 + + if sbin/rc-service -e udev; then + echo "Registering udev OpenRC service..." + sbin/rc-update add udev sysinit + [ $? -ne 0 ] && exit $? + sbin/rc-update -u + fi + ;; +esac diff --git a/templates/udev/REMOVE b/templates/udev/REMOVE new file mode 100644 index 00000000000..b0a075fa14b --- /dev/null +++ b/templates/udev/REMOVE @@ -0,0 +1,20 @@ +# +# This script unregisters the udev service from the +# 'sysinit' runlevel, as required by OpenRC. +# + +case "${ACTION}" in +pre) + [ ! -x sbin/rc-update ] && exit 0 + [ ! -x sbin/rc-service ] && exit 0 + + if sbin/rc-service -e udev; then + echo "Unregistering udev OpenRC service..." + sbin/rc-update del udev sysinit + [ $? -ne 0 ] && exit $? + sbin/rc-update -u + fi + ;; +post) + ;; +esac diff --git a/templates/udev/files/udev.rc b/templates/udev/files/udev.rc new file mode 100644 index 00000000000..6c5a86cde65 --- /dev/null +++ b/templates/udev/files/udev.rc @@ -0,0 +1,25 @@ +#!/sbin/runscript +# +# OpenRC service for udev(7). + +command=/sbin/udevd +command_args="--daemon" +name="UDev Daemon" + +depend() +{ + provide dev + need sysfs + before checkfs fsck + keyword novserver +} + +start() +{ + echo > /proc/sys/kernel/hotplug + + ebegin "Starting UDev and waiting for uevents" + ${command} ${command_args} && \ + udevadm trigger && udevadm settle + eend $? +} diff --git a/templates/udev/template b/templates/udev/template index c8c270d3b80..72808b664f2 100644 --- a/templates/udev/template +++ b/templates/udev/template @@ -1,6 +1,7 @@ # Template file for 'udev' pkgname=udev version=141 +revision=1 patch_files="arch-udev-rules.diff" distfiles="${KERNEL_SITE}/utils/kernel/hotplug/udev-${version}.tar.bz2" build_style=gnu_configure @@ -37,4 +38,7 @@ post_install() ln -s /proc/self/fd/1 $DESTDIR/lib/udev/devices/stdout ln -s /proc/self/fd/2 $DESTDIR/lib/udev/devices/stderr ln -s /proc/kcore $DESTDIR/lib/udev/devices/core + + # Install the OpenRC service + install -D -m755 ${FILESDIR}/udev.rc ${DESTDIR}/etc/init.d/udev }