summaryrefslogtreecommitdiff
path: root/xi/init.d/udev_retry
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-29 23:36:22 +0100
committerdavidovski <david@davidovski.xyz>2022-03-29 23:36:22 +0100
commitdf88860947686a5e6507fc5d60ff33eac1158c6b (patch)
treed1dc7f2f003b08afb6d45f7170d7a0dd353060d3 /xi/init.d/udev_retry
parent33d239ecb3d66db2b005afbe68a7029c3f2d2ee0 (diff)
using sysvinit system bootscriptsHEADmaster
Diffstat (limited to 'xi/init.d/udev_retry')
-rw-r--r--xi/init.d/udev_retry75
1 files changed, 75 insertions, 0 deletions
diff --git a/xi/init.d/udev_retry b/xi/init.d/udev_retry
new file mode 100644
index 0000000..112846a
--- /dev/null
+++ b/xi/init.d/udev_retry
@@ -0,0 +1,75 @@
+#!/bin/sh
+########################################################################
+# Begin udev_retry
+#
+# Description : Udev cold-plugging script (retry)
+#
+# Authors : Alexander E. Patrakov
+# DJ Lucas - dj@linuxfromscratch.org
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
+# Bryan Kadzban -
+#
+# Version : LFS 7.0
+#
+########################################################################
+
+### BEGIN INIT INFO
+# Provides: udev_retry
+# Required-Start: udev
+# Should-Start: $local_fs cleanfs
+# Required-Stop:
+# Should-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Replays failed uevents and creates additional devices.
+# Description: Replays any failed uevents that were skipped due to
+# slow hardware initialization, and creates those needed
+# device nodes
+# X-LFS-Provided-By: LFS
+### END INIT INFO
+
+. /lib/lsb/init-functions
+
+case "${1}" in
+ start)
+ log_info_msg "Retrying failed uevents, if any..."
+
+ # As of udev-186, the --run option is no longer valid
+ #rundir=$(/sbin/udevadm info --run)
+ rundir=/run/udev
+ # From Debian: "copy the rules generated before / was mounted
+ # read-write":
+
+ for file in ${rundir}/tmp-rules--*; do
+ dest=${file##*tmp-rules--}
+ [ "$dest" = '*' ] && break
+ cat $file >> /etc/udev/rules.d/$dest
+ rm -f $file
+ done
+
+ # Re-trigger the uevents that may have failed,
+ # in hope they will succeed now
+ /bin/sed -e 's/#.*$//' /etc/sysconfig/udev_retry | /bin/grep -v '^$' | \
+ while read line ; do
+ for subsystem in $line ; do
+ /sbin/udevadm trigger --subsystem-match=$subsystem --action=add
+ done
+ done
+
+ # Now wait for udevd to process the uevents we triggered
+ if ! is_true "$OMIT_UDEV_RETRY_SETTLE"; then
+ /sbin/udevadm settle
+ fi
+
+ evaluate_retval
+ ;;
+
+ *)
+ echo "Usage ${0} {start}"
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# End udev_retry