aboutsummaryrefslogtreecommitdiffstats
path: root/bootscripts/contrib/lsb-v3/init.d/udev_retry
blob: b87a7b3e9504b9464be957be40b408e795132122 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
# Begin $rc_base/init.d/udev_retry

### BEGIN INIT INFO
# Provides:            udev_retry
# Required-Start:      udev
# Should-Start:        $local_fs
# Required-Stop:
# Should-Stop:
# Default-Start:       sysinit
# Default-Stop:
# Short-Description:   Replays failed uevents and creates additonal devices.
# Description:         Replays any failed uevents that were skipped due to
#                      slow hardware initialization, and creates those needed
#                      device nodes
# X-LFS-Default-Start: S45
# X-LFS-Default-Stop:
# X-LFS-Provided-By:   LFS
### END INIT INFO

. /lib/lsb/init-functions

MESSAGE="Retrying failed uevents, if any..."

case "${1}" in
	start)

                # From Debian: "copy the rules generated before / was mounted
                # read-write":
                for file in /dev/.udev/tmp-rules--*; do
                        dest=${file##*tmp-rules--}
                        [ "$dest" = '*' ] && break
                        cat $file >> /etc/udev/rules.d/$dest
                        rm -f $file
                done

                # Re-trigger the failed uevents in hope they will succeed now
                /sbin/udevadm trigger --retry-failed

		# Now wait for udevd to process the uevents we triggered
		/sbin/udevadm settle
		evaluate_retval standard
		;;

	*)
		echo "Usage ${0} {start}"
		exit 1
		;;
esac

# End $rc_base/init.d/udev_retry