#!/sbin/runscript # Copyright 1999-2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 udev_version() { udevadm --version } depend() { need localmount if [ $(udev_version) -lt 175 ]; then after dbus # for trigger failed fi keyword -vserver -lxc } dir_writeable() { touch "$1"/.test.$$ 2>/dev/null && rm "$1"/.test.$$ } # store persistent-rules that got created while booting # when / was still read-only store_persistent_rules() { # only continue if rules-directory is writable dir_writeable /etc/udev/rules.d || return 0 local file dest for file in "${RUNDIR}"/tmp-rules--*; do dest=${file##*tmp-rules--} [ "$dest" = '*' ] && break type=${dest##70-persistent-} type=${type%%.rules} ebegin "Saving udev persistent ${type} rules to /etc/udev/rules.d" cat "$file" >> /etc/udev/rules.d/"$dest" && rm -f "$file" eend $? "Failed moving persistent rules!" done } start() { RUNDIR=$(udevadm info --run) # check if this system uses udev [ -d "${RUNDIR}" ] || return 0 einfo "Doing udev cleanups" if [ $(udev_version) -lt 175 ]; then # Run the events that failed at first udev trigger udevadm trigger --type=failed -v fi # store persistent-rules that got created while booting # when / was still read-only store_persistent_rules } stop() { return 0 } # vim:ts=4