summaryrefslogtreecommitdiffstats
path: root/modules.d/95virtiofs/mount-virtiofs.sh
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d/95virtiofs/mount-virtiofs.sh')
-rwxr-xr-xmodules.d/95virtiofs/mount-virtiofs.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/modules.d/95virtiofs/mount-virtiofs.sh b/modules.d/95virtiofs/mount-virtiofs.sh
new file mode 100755
index 0000000..3d73884
--- /dev/null
+++ b/modules.d/95virtiofs/mount-virtiofs.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+type ismounted > /dev/null 2>&1 || . /lib/dracut-lib.sh
+
+if [ "${fstype}" = "virtiofs" -o "${root%%:*}" = "virtiofs" ]; then
+ if ! load_fstype virtiofs; then
+ die "virtiofs is required but not available."
+ fi
+
+ mount -t virtiofs -o "$rflags" "${root#virtiofs:}" "$NEWROOT" 2>&1 | vinfo
+ if ! ismounted "$NEWROOT"; then
+ die "virtiofs: failed to mount root fs"
+ fi
+
+ info "virtiofs: root fs mounted (options: '${rflags}')"
+
+ [ -f "$NEWROOT"/forcefsck ] && rm -f -- "$NEWROOT"/forcefsck 2> /dev/null
+ [ -f "$NEWROOT"/.autofsck ] && rm -f -- "$NEWROOT"/.autofsck 2> /dev/null
+fi
+: