summaryrefslogtreecommitdiff
path: root/extra/eudev
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-30 00:50:53 +0100
committerdavidovski <david@davidovski.xyz>2022-03-30 00:50:53 +0100
commitffd7994da3b5c8021aa040f6ca4244f391eb9a0a (patch)
tree3492107ce7a1dd98ab64e9a8a5dd6e19fb544a6c /extra/eudev
parentd28d2287b138ede0591d9facd5dbe7ca4f329f83 (diff)
fixed initd scripts for udev and sysklogd
Diffstat (limited to 'extra/eudev')
-rw-r--r--extra/eudev/udev.initd22
-rw-r--r--extra/eudev/udev_retry.initd31
2 files changed, 53 insertions, 0 deletions
diff --git a/extra/eudev/udev.initd b/extra/eudev/udev.initd
new file mode 100644
index 0000000..5ce2354
--- /dev/null
+++ b/extra/eudev/udev.initd
@@ -0,0 +1,22 @@
+#!/sbin/openrc-run
+
+start () {
+ # Start the udev daemon to continually watch for, and act on,
+ # uevents
+ /sbin/udevd --daemon
+
+ # Now traverse /sys in order to "coldplug" devices that have
+ # already been discovered
+ /sbin/udevadm trigger --action=add --type=subsystems
+ /sbin/udevadm trigger --action=add --type=devices
+ /sbin/udevadm trigger --action=change --type=devices
+
+ # Now wait for udevd to process the uevents we triggered
+ if ! is_true "$OMIT_UDEV_SETTLE"; then
+ /sbin/udevadm settle
+ fi
+
+ # If any LVM based partitions are on the system, ensure they
+ # are activated so they can be used.
+ if [ -x /sbin/vgchange ]; then /sbin/vgchange -a y >/dev/null; fi
+}
diff --git a/extra/eudev/udev_retry.initd b/extra/eudev/udev_retry.initd
new file mode 100644
index 0000000..cfe077c
--- /dev/null
+++ b/extra/eudev/udev_retry.initd
@@ -0,0 +1,31 @@
+#!/sbin/openrc-run
+start () {
+ echo "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
+}