You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.6 KiB
87 lines
2.6 KiB
From ca64eeec79c93b89aea51b3f26d9539db5cf2a65 Mon Sep 17 00:00:00 2001 |
|
From: Harald Hoyer <harald@redhat.com> |
|
Date: Thu, 30 Jun 2016 15:22:47 +0200 |
|
Subject: [PATCH] virtfs: use systemd generator |
|
|
|
use a systemd generator, instead of a dracut hook to mount |
|
--- |
|
modules.d/95virtfs/module-setup.sh | 7 ++++- |
|
modules.d/95virtfs/parse-virtfs.sh | 2 +- |
|
modules.d/95virtfs/virtfs-generator.sh | 39 ++++++++++++++++++++++++++ |
|
3 files changed, 46 insertions(+), 2 deletions(-) |
|
create mode 100755 modules.d/95virtfs/virtfs-generator.sh |
|
|
|
diff --git a/modules.d/95virtfs/module-setup.sh b/modules.d/95virtfs/module-setup.sh |
|
index 12bd354b..3d80b75f 100755 |
|
--- a/modules.d/95virtfs/module-setup.sh |
|
+++ b/modules.d/95virtfs/module-setup.sh |
|
@@ -37,5 +37,10 @@ installkernel() { |
|
|
|
install() { |
|
inst_hook cmdline 95 "$moddir/parse-virtfs.sh" |
|
- inst_hook mount 99 "$moddir/mount-virtfs.sh" |
|
+ |
|
+ if ! dracut_module_included "systemd"; then |
|
+ inst_hook mount 99 "$moddir/mount-virtfs.sh" |
|
+ else |
|
+ inst_script "$moddir/virtfs-generator.sh" $systemdutildir/system-generators/dracut-virtfs-generator |
|
+ fi |
|
} |
|
diff --git a/modules.d/95virtfs/parse-virtfs.sh b/modules.d/95virtfs/parse-virtfs.sh |
|
index ce6de6d4..a9ad48a9 100755 |
|
--- a/modules.d/95virtfs/parse-virtfs.sh |
|
+++ b/modules.d/95virtfs/parse-virtfs.sh |
|
@@ -3,7 +3,7 @@ |
|
# ex: ts=8 sw=4 sts=4 et filetype=sh |
|
|
|
if [ "${root%%:*}" = "virtfs" ] ; then |
|
- modprobe 9pnet_virtio |
|
+ initqueue --onetime modprobe -b -q 9pnet_virtio |
|
|
|
rootok=1 |
|
fi |
|
diff --git a/modules.d/95virtfs/virtfs-generator.sh b/modules.d/95virtfs/virtfs-generator.sh |
|
new file mode 100755 |
|
index 00000000..3bdddf11 |
|
--- /dev/null |
|
+++ b/modules.d/95virtfs/virtfs-generator.sh |
|
@@ -0,0 +1,39 @@ |
|
+#!/bin/sh |
|
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*- |
|
+# ex: ts=8 sw=4 sts=4 et filetype=sh |
|
+ |
|
+type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh |
|
+ |
|
+[ -z "$root" ] && root=$(getarg root=) |
|
+ |
|
+[ "${root%%:*}" = "virtfs" ] || exit 0 |
|
+ |
|
+GENERATOR_DIR="$2" |
|
+[ -z "$GENERATOR_DIR" ] && exit 1 |
|
+ |
|
+[ -d "$GENERATOR_DIR" ] || mkdir "$GENERATOR_DIR" |
|
+ |
|
+ROOTFLAGS=$(getarg rootflags=) || ROOTFLAGS="trans=virtio,version=9p2000.L" |
|
+ROOTFSTYPE=$(getarg rootfstype=) || ROOTFSTYPE="9p" |
|
+ |
|
+root=${root#virtfs:} |
|
+ |
|
+if getarg "ro"; then |
|
+ if [ -n "$ROOTFLAGS" ]; then |
|
+ ROOTFLAGS="$ROOTFLAGS,ro" |
|
+ else |
|
+ ROOTFLAGS="ro" |
|
+ fi |
|
+fi |
|
+ |
|
+{ |
|
+ echo "[Unit]" |
|
+ echo "Before=initrd-root-fs.target" |
|
+ echo "[Mount]" |
|
+ echo "Where=/sysroot" |
|
+ echo "What=${root}" |
|
+ [ -n "$ROOTFSTYPE" ] && echo "Type=${ROOTFSTYPE}" |
|
+ [ -n "$ROOTFLAGS" ] && echo "Options=${ROOTFLAGS}" |
|
+} > "$GENERATOR_DIR"/sysroot.mount |
|
+ |
|
+exit 0
|
|
|