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