Files
sablink-distro/sys-fs/udev/files/udev.initd
T

60 lines
1.4 KiB
Plaintext
Executable File

#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
description="Mount /dev and let udev create the device-nodes"
depend()
{
if [ -f /etc/init.d/sysfs ]; then
# require new enough openrc with sysinit being extra runlevel
# on linux we just check if sysfs init-script exists
# this is to silence out ugly warnings about not-existing sysfs script
provide dev
need sysfs
before checkfs fsck
# udev does not work inside vservers
keyword novserver
fi
}
display_hotplugged_services() {
local svcfile= svc= services=
for svcfile in "${RC_SVCDIR}"/hotplugged/*; do
svc="${svcfile##*/}"
[ -x "${svcfile}" ] || continue
# do not display this - better: do only inject it later :)
[ "$svc" = "udev-postmount" ] && continue
services="${services} ${svc}"
done
[ -n "${services}" ] && einfo "Device initiated services:${HILITE}${services}${NORMAL}"
}
inject_postmount_initd() {
mark_service_hotplugged udev-postmount
#einfo "Injected udev-postmount service"
}
start()
{
# do not run this on too old baselayout - udev-addon is already loaded!
if [ ! -e /lib/librc.so -a -f /etc/init.d/sysfs ]; then
eerror "The $SVCNAME init-script is written for baselayout-2!"
eerror "Please do not use it with baselayout-1!".
return 1
fi
start_addon udev || return 1
display_hotplugged_services
inject_postmount_initd
return 0
}
stop()
{
stop_addon udev
}