#!/bin/bash

# sourcing our current rc.conf requires this to be a bash script
. /usr/lib/rc/functions

case "$1" in
    start)
        stat_busy "Starting udev daemon"
        udevd --daemon || stat_die udev
        # Note: This is only needed for initialization, udev will
        #       be controlled by runit on stage 2.
        add_daemon udev
        stat_done udev
        ;;
    stop)
        stat_busy "Stopping udev"
        # check whether udevd might still be running.
        ! pgrep -f "udevd" >/dev/null 2>&1 || udevadm control --exit || stat_die udev
        rm_daemon udev
        stat_done udev
        ;;
    *)
        echo "usage: $0 {start|stop}"
        exit 1
        ;;
esac

