coreos-installer/SOURCES/coidracut4.patch
2021-10-08 17:50:19 +00:00

81 lines
2.2 KiB
Diff

diff --git a/systemd/coreos-installer-generator b/systemd/coreos-installer-generator
index b2bcaec..2b85dc5 100755
--- a/systemd/coreos-installer-generator
+++ b/systemd/coreos-installer-generator
@@ -2,6 +2,8 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
+command -v getarg >/dev/null || . /usr/lib/dracut-lib.sh
+
set -e
# Generators don't have logging right now
@@ -10,6 +12,14 @@ exec 1>/dev/kmsg; exec 2>&1
UNIT_DIR="${1:-/tmp}"
+add_requires() {
+ local name="$1"; shift
+ local target="$1"; shift
+ local requires_dir="${UNIT_DIR}/${target}.requires"
+ mkdir -p "${requires_dir}"
+ ln -sf "../${name}" "${requires_dir}/${name}"
+}
+
cmdline=( $(</proc/cmdline) )
karg() {
local name="$1" value="$2"
@@ -38,3 +48,38 @@ if [ -n "$(karg coreos.inst.install_dev)" ]; then
> /run/coreos-installer-reboot
fi
fi
+
+add_requires run-media-iso.mount default.target
+
+isoroot=$(getarg edge.liveiso= ||:)
+
+mkdir -p /run/media/iso
+isosrc=dev/disk/by-label/${isoroot}
+isosrc_escaped=$(systemd-escape -p --suffix=device "${isosrc}")
+
+if [ -n "${isoroot}" ]; then
+cat >"${UNIT_DIR}/run-media-iso.mount" <<EOF
+# Automatically generated by live-generator
+[Unit]
+DefaultDependencies=false
+# HACK for https://github.com/coreos/fedora-coreos-config/issues/437
+Wants=systemd-udev-settle.service
+Wants=systemd-udevd.service
+After=systemd-udevd.service
+After=basic.target
+# Network is enabled here
+After=nm-run.service
+# compat: remove when everyone is on dracut 053+
+After=dracut-initqueue.service
+
+Before=coreos-installer.service
+After=${isosrc_escaped}
+Requires=${isosrc_escaped}
+ConditionKernelCommandLine=coreos.inst.image_file
+[Mount]
+What=/${isosrc}
+Where=/run/media/iso
+Options=ro
+Type=iso9660
+EOF
+fi
\ No newline at end of file
diff --git a/systemd/growfs.service b/systemd/growfs.service
index 6d77aaa..fee934d 100644
--- a/systemd/growfs.service
+++ b/systemd/growfs.service
@@ -5,7 +5,6 @@ DefaultDependencies=false
After=coreos-installer.service
Before=coreos-installer-reboot.service
Requires=dev-disk-by\x2dlabel-root.device
-After=dev-disk-by\x2dlabel-root.device
[Service]
Type=oneshot