[1c48007] | 1 | #!/bin/sh
|
---|
| 2 | ########################################################################
|
---|
[0cda898] | 3 | # Begin udev_retry
|
---|
[1c48007] | 4 | #
|
---|
| 5 | # Description : Udev cold-plugging script (retry)
|
---|
| 6 | #
|
---|
| 7 | # Authors : Alexander E. Patrakov
|
---|
[f874424] | 8 | # DJ Lucas - dj@linuxfromscratch.org
|
---|
[0cda898] | 9 | # Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
---|
[2a1c1e0] | 10 | # Bryan Kadzban -
|
---|
[1c48007] | 11 | #
|
---|
[0cda898] | 12 | # Version : LFS 7.0
|
---|
[1c48007] | 13 | #
|
---|
| 14 | ########################################################################
|
---|
| 15 |
|
---|
[0cda898] | 16 | ### BEGIN INIT INFO
|
---|
| 17 | # Provides: udev_retry
|
---|
| 18 | # Required-Start: udev
|
---|
[d7f58cc] | 19 | # Should-Start: $local_fs cleanfs
|
---|
[0cda898] | 20 | # Required-Stop:
|
---|
| 21 | # Should-Stop:
|
---|
| 22 | # Default-Start: S
|
---|
| 23 | # Default-Stop:
|
---|
[cb02946] | 24 | # Short-Description: Replays failed uevents and creates additional devices.
|
---|
[0cda898] | 25 | # Description: Replays any failed uevents that were skipped due to
|
---|
| 26 | # slow hardware initialization, and creates those needed
|
---|
| 27 | # device nodes
|
---|
| 28 | # X-LFS-Provided-By: LFS
|
---|
| 29 | ### END INIT INFO
|
---|
| 30 |
|
---|
[f874424] | 31 | . /lib/lsb/init-functions
|
---|
[1c48007] | 32 |
|
---|
| 33 | case "${1}" in
|
---|
[0cda898] | 34 | start)
|
---|
[f874424] | 35 | log_info_msg "Retrying failed uevents, if any..."
|
---|
[0cda898] | 36 |
|
---|
[9b7cbc7] | 37 | # As of udev-186, the --run option is no longer valid
|
---|
[f6fe500] | 38 | #rundir=$(/sbin/udevadm info --run)
|
---|
[36ba266] | 39 | rundir=/run/udev
|
---|
[0cda898] | 40 | # From Debian: "copy the rules generated before / was mounted
|
---|
| 41 | # read-write":
|
---|
| 42 |
|
---|
[f874424] | 43 | for file in ${rundir}/tmp-rules--*; do
|
---|
[0cda898] | 44 | dest=${file##*tmp-rules--}
|
---|
| 45 | [ "$dest" = '*' ] && break
|
---|
| 46 | cat $file >> /etc/udev/rules.d/$dest
|
---|
| 47 | rm -f $file
|
---|
| 48 | done
|
---|
| 49 |
|
---|
[2a1c1e0] | 50 | # Re-trigger the uevents that may have failed,
|
---|
| 51 | # in hope they will succeed now
|
---|
| 52 | /bin/sed -e 's/#.*$//' /etc/sysconfig/udev_retry | /bin/grep -v '^$' | \
|
---|
| 53 | while read line ; do
|
---|
| 54 | for subsystem in $line ; do
|
---|
[f6fe500] | 55 | /sbin/udevadm trigger --subsystem-match=$subsystem --action=add
|
---|
[2a1c1e0] | 56 | done
|
---|
| 57 | done
|
---|
[0cda898] | 58 |
|
---|
| 59 | # Now wait for udevd to process the uevents we triggered
|
---|
[85ce884e] | 60 | if ! is_true "$OMIT_UDEV_RETRY_SETTLE"; then
|
---|
[f6fe500] | 61 | /sbin/udevadm settle
|
---|
[85ce884e] | 62 | fi
|
---|
| 63 |
|
---|
[642e2e9] | 64 | evaluate_retval
|
---|
[0cda898] | 65 | ;;
|
---|
| 66 |
|
---|
| 67 | *)
|
---|
| 68 | echo "Usage ${0} {start}"
|
---|
| 69 | exit 1
|
---|
| 70 | ;;
|
---|
[1c48007] | 71 | esac
|
---|
| 72 |
|
---|
[f874424] | 73 | exit 0
|
---|
| 74 |
|
---|
[0cda898] | 75 | # End udev_retry
|
---|