ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Harald Hoyer fe20ad
From 03c6b09de9b0d2b96657bc4b2b6d59b8425e3d12 Mon Sep 17 00:00:00 2001
Harald Hoyer fe20ad
From: WANG Chao <chaowang@redhat.com>
Harald Hoyer fe20ad
Date: Thu, 8 Aug 2013 15:18:11 +0800
Harald Hoyer fe20ad
Subject: [PATCH] fstab-generator: respect noauto/nofail when adding sysroot
Harald Hoyer fe20ad
 mount
Harald Hoyer fe20ad
Harald Hoyer fe20ad
Currently we don't respect noauto/nofail root mount options (from
Harald Hoyer fe20ad
rootflags kernel cmdline). We should map these two flags to the
Harald Hoyer fe20ad
corresponding boolean variable noauto and nofail when calling
Harald Hoyer fe20ad
add_mount().
Harald Hoyer fe20ad
---
Harald Hoyer fe20ad
 src/fstab-generator/fstab-generator.c | 6 +++++-
Harald Hoyer fe20ad
 1 file changed, 5 insertions(+), 1 deletion(-)
Harald Hoyer fe20ad
Harald Hoyer fe20ad
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
Harald Hoyer fe20ad
index c17299f..87b17cd 100644
Harald Hoyer fe20ad
--- a/src/fstab-generator/fstab-generator.c
Harald Hoyer fe20ad
+++ b/src/fstab-generator/fstab-generator.c
Harald Hoyer fe20ad
@@ -492,6 +492,7 @@ static int parse_new_root_from_proc_cmdline(void) {
Harald Hoyer fe20ad
         char *w, *state;
Harald Hoyer fe20ad
         int r;
Harald Hoyer fe20ad
         size_t l;
Harald Hoyer fe20ad
+        bool noauto, nofail;
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
         r = read_one_line_file("/proc/cmdline", &line);
Harald Hoyer fe20ad
         if (r < 0) {
Harald Hoyer fe20ad
@@ -547,6 +548,9 @@ static int parse_new_root_from_proc_cmdline(void) {
Harald Hoyer fe20ad
                 }
Harald Hoyer fe20ad
         }
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
+        noauto = !!strstr(opts, "noauto");
Harald Hoyer fe20ad
+        nofail = !!strstr(opts, "nofail");
Harald Hoyer fe20ad
+
Harald Hoyer fe20ad
         if (!what) {
Harald Hoyer fe20ad
                 log_debug("Could not find a root= entry on the kernel commandline.");
Harald Hoyer fe20ad
                 return 0;
Harald Hoyer fe20ad
@@ -558,7 +562,7 @@ static int parse_new_root_from_proc_cmdline(void) {
Harald Hoyer fe20ad
         }
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
         log_debug("Found entry what=%s where=/sysroot type=%s", what, type);
Harald Hoyer fe20ad
-        r = add_mount(what, "/sysroot", type, opts, 0, false, false, false,
Harald Hoyer fe20ad
+        r = add_mount(what, "/sysroot", type, opts, 0, noauto, nofail, false,
Harald Hoyer fe20ad
                       false, NULL, NULL, NULL, SPECIAL_INITRD_ROOT_FS_TARGET, "/proc/cmdline");
Harald Hoyer fe20ad
 
Harald Hoyer fe20ad
         return (r < 0) ? r : 0;