Ticket #1769: udev_retry

File udev_retry, 1.4 KB (added by alexander@…, 19 years ago)

New udev_retry script

Line 
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/udev
4#
5# Description : Udev cold-plugging script (retry)
6#
7# Authors : Zack Winkles, Alexander E. Patrakov
8#
9# Version : 00.02
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17
18case "${1}" in
19 start)
20 boot_mesg "Retrying failed uevents, if any..."
21 # Re-trigger the failed uevents in hope they will succeed now
22 # If there are none, the "No such file or directory" error
23 # goes to /dev/null
24 for file in /dev/.udev/failed/*/uevent ; do
25 echo "add" >"${file}"
26 done 2>/dev/null
27
28 # Now wait for udevd to process the uevents we triggered
29 /sbin/udevsettle
30 failed="${?}"
31 > /dev/bug
32 sleep 6
33 if test -s /dev/bug; then
34 mv /dev/bug /dev/bugreport
35 failed="2"
36 else
37 rm -f /dev/bug
38 fi
39 (exit "${failed}")
40 evaluate_retval
41
42 if [ "${failed}" -eq "2" ]; then
43 boot_mesg "Some uevents escaped from the \"udevsettle\" program." ${FAILURE}
44 boot_mesg "This is a bug either in the kernel or in the program itself."
45 boot_mesg "Please mail the /dev/bugreport file to lfs-dev@linuxfromscratch.org."
46 boot_mesg "Otherwise, the next version of LFS may be unbootable on your system!"
47 echo_failure
48 sleep 10
49 exit 1
50 fi
51
52 ;;
53
54 *)
55 echo "Usage ${0} {start}"
56 exit 1
57 ;;
58esac
59
60# End $rc_base/init.d/udev