#!/sbin/openrc-run
# Copyright 2022 Laurent Bercot for Alpine Linux
# Distributed under the terms of the ISC License.

description="a netlink-listening device manager similar to mdev"
extra_started_commands="reload"
description_reload="Reload mdevd's configuration file"
command="/usr/bin/mdevd"
command_args="-O4"  # send handled events to nlgrp 4 for libudev-zero
command_background="yes"
pidfile="/run/mdevd.pid"

depend() {
	provide dev
	need sysfs dev-mount
	before checkfs fsck
	keyword -containers -lxc -vserver
}

reload() {
	kill -1 `cat "$pidfile"`
}
