Blame | Last modification | View Log | RSS feed
#!/bin/bash## udev-post Post script for udev, after all filesystems are mounted## Authors: Harald Hoyer <harald@redhat.com>## chkconfig: 12345 26 75# description: Moves the generated persistent udev rules to /etc/udev/rules.d#### BEGIN INIT INFO# Default-Start: 12345# Default-Stop: 0 6# Required-Start: $local_fs# Required-Stop:# Short-Description: Moves the generated persistent udev rules to /etc/udev/rules.d# Description: Moves the generated persistent udev rules to /etc/udev/rules.d# Provides: udev-post### END INIT INFO. /etc/rc.d/init.d/functions. /etc/sysconfig/udev# See how we were called.case "$1" instart|reload)[ -w /var/lock/subsys ] || exit 4STRING=$"Retrigger failed udev events"echo -n $STRING/sbin/udevadm trigger --type=failedsuccess "$STRING"echoSTRING=$"Adding udev persistent rules"# copy the rules generated before / was mounted read-writefor file in /dev/.udev/tmp-rules--*; dodest=${file##*tmp-rules--}# check, if anything is todo[ "$dest" = '*' ] && exit 0echo -n $STRINGcat $file >> /etc/udev/rules.d/$destrc=$(($rc+$?))rm -f $filedoneif [ "$rc" -eq "0" ]; thensuccess "$STRING"echoelif [ "$rc" -eq "1" ]; thenfailure "$STRING"echofitouch /var/lock/subsys/udev-postexit 0;;stop)[ -w /var/lock/subsys ] || exit 4STRING=$"Generating udev makedev cache file"MAKEDEV="/sbin/MAKEDEV"USE_MD5="false"[ -x /usr/bin/md5sum -a "$UDEV_USE_MAKEDEV_CACHE" == "yes" ] && USE_MD5="true"if [ "$USE_MD5" == "true" -a -x "$MAKEDEV" ]; thenfor i in /etc/udev/makedev.d/*.nodes; doif [ -f "$i" ]; then# use a little caching to speedup thingsmd5=$(/usr/bin/md5sum "$i"|(read a b; echo $a))md5file="/var/lib/udev/makedev.d/${md5}.sh"if [ ! -f "$md5file" ]; thenecho -n $STRING( sed -e 's,#.*,,g' "$i" | \xargs $MAKEDEV -x -a -S ) \> "$md5file"rc=$?if [ "$rc" -eq "0" ]; thensuccess "$STRING"echoelif [ "$rc" -eq "1" ]; thenfailure "$STRING"echofififidonefirm -f /var/lock/subsys/udev-postexit 0;;status)exit 0;;*)echo $"Usage: $0 {start|stop|reload}"exit 2esacexit 0