chiark / gitweb /
fstab-generator: Allow mount.usr without mount.usrflags, honor rw/ro
authorMichael Marineau <michael.marineau@coreos.com>
Mon, 8 Dec 2014 19:05:31 +0000 (11:05 -0800)
committerLennart Poettering <lennart@poettering.net>
Tue, 9 Dec 2014 01:24:26 +0000 (02:24 +0100)
There is no need to require mount.usrflags. The original implementation
assumed that a btrfs subvolume would always be needed but that is not
applicable to systems that do not use btrfs for /usr.

Similar to using rootflags= for the default of mount.usrflags=, append
the classic 'ro' and 'rw' flags to the mount options.

src/fstab-generator/fstab-generator.c

index 568b02a434e7c676da034f19e8eae1fd734d5127..1f345949289902270a98adaa96b478702a689db9 100644 (file)
@@ -476,7 +476,7 @@ static int add_usr_mount(void) {
                         return log_oom();
         }
 
-        if (!arg_usr_what || !arg_usr_options)
+        if (!arg_usr_what)
                 return 0;
 
         what = fstab_node_to_udev_node(arg_usr_what);
@@ -485,7 +485,13 @@ static int add_usr_mount(void) {
                 return -1;
         }
 
-        opts = arg_usr_options;
+        if (!arg_usr_options)
+                opts = arg_root_rw > 0 ? "rw" : "ro";
+        else if (!mount_test_option(arg_usr_options, "ro") &&
+                 !mount_test_option(arg_usr_options, "rw"))
+                opts = strappenda(arg_usr_options, ",", arg_root_rw > 0 ? "rw" : "ro");
+        else
+                opts = arg_usr_options;
 
         log_debug("Found entry what=%s where=/sysroot/usr type=%s", what, strna(arg_usr_fstype));
         return add_mount(what,