|
|
a56a5e |
From 5a3b267d06cc81fcb7e0374c7656a1f48d031497 Mon Sep 17 00:00:00 2001
|
|
|
966cef |
From: Harald Hoyer <harald@redhat.com>
|
|
|
966cef |
Date: Tue, 25 Feb 2014 12:54:28 +0100
|
|
|
966cef |
Subject: [PATCH] systemd/rootfs-generator.sh: generate units in
|
|
|
966cef |
/run/systemd/generator
|
|
|
966cef |
|
|
|
966cef |
Generate the units in /run/systemd/generator, so they are picked up by
|
|
|
966cef |
systemd.
|
|
|
966cef |
|
|
|
966cef |
https://bugzilla.redhat.com/show_bug.cgi?id=1069133
|
|
|
966cef |
https://bugzilla.redhat.com/show_bug.cgi?id=949697
|
|
|
966cef |
---
|
|
|
966cef |
modules.d/98systemd/rootfs-generator.sh | 33 ++++++++++++++++++++++++++++++++-
|
|
|
966cef |
1 file changed, 32 insertions(+), 1 deletion(-)
|
|
|
966cef |
|
|
|
966cef |
diff --git a/modules.d/98systemd/rootfs-generator.sh b/modules.d/98systemd/rootfs-generator.sh
|
|
|
966cef |
index 9810026..a11ce59 100755
|
|
|
966cef |
--- a/modules.d/98systemd/rootfs-generator.sh
|
|
|
966cef |
+++ b/modules.d/98systemd/rootfs-generator.sh
|
|
|
966cef |
@@ -3,6 +3,37 @@
|
|
|
966cef |
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
|
|
966cef |
|
|
|
966cef |
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
|
|
966cef |
+
|
|
|
966cef |
+generator_wait_for_dev()
|
|
|
966cef |
+{
|
|
|
966cef |
+ local _name
|
|
|
966cef |
+
|
|
|
966cef |
+ _name="$(str_replace "$1" '/' '\x2f')"
|
|
|
966cef |
+
|
|
|
966cef |
+ [ -e "$hookdir/initqueue/finished/devexists-${_name}.sh" ] && return 0
|
|
|
966cef |
+
|
|
|
966cef |
+ printf '[ -e "%s" ]\n' $1 \
|
|
|
966cef |
+ >> "$hookdir/initqueue/finished/devexists-${_name}.sh"
|
|
|
966cef |
+ {
|
|
|
966cef |
+ printf '[ -e "%s" ] || ' $1
|
|
|
966cef |
+ printf 'warn "\"%s\" does not exist"\n' $1
|
|
|
966cef |
+ } >> "$hookdir/emergency/80-${_name}.sh"
|
|
|
966cef |
+
|
|
|
966cef |
+ _name=$(dev_unit_name "$1")
|
|
|
966cef |
+ if ! [ -L /run/systemd/generator/initrd.target.wants/${_name}.device ]; then
|
|
|
966cef |
+ [ -d /run/systemd/generator/initrd.target.wants ] || mkdir -p /run/systemd/generator/initrd.target.wants
|
|
|
966cef |
+ ln -s ../${_name}.device /run/systemd/generator/initrd.target.wants/${_name}.device
|
|
|
966cef |
+ fi
|
|
|
966cef |
+
|
|
|
966cef |
+ if ! [ -f /run/systemd/generator/${_name}.device.d/timeout.conf ]; then
|
|
|
966cef |
+ mkdir -p /run/systemd/generator/${_name}.device.d
|
|
|
966cef |
+ {
|
|
|
966cef |
+ echo "[Unit]"
|
|
|
966cef |
+ echo "JobTimeoutSec=3600"
|
|
|
966cef |
+ } > /run/systemd/generator/${_name}.device.d/timeout.conf
|
|
|
966cef |
+ fi
|
|
|
966cef |
+}
|
|
|
966cef |
+
|
|
|
966cef |
root=$(getarg root=)
|
|
|
966cef |
case "$root" in
|
|
|
966cef |
block:LABEL=*|LABEL=*)
|
|
|
966cef |
@@ -29,6 +60,6 @@ case "$root" in
|
|
|
966cef |
rootok=1 ;;
|
|
|
966cef |
esac
|
|
|
966cef |
|
|
|
966cef |
-[ "${root%%:*}" = "block" ] && wait_for_dev -n "${root#block:}"
|
|
|
966cef |
+[ "${root%%:*}" = "block" ] && generator_wait_for_dev "${root#block:}"
|
|
|
966cef |
|
|
|
966cef |
exit 0
|