From 093c2cfe3b1ae6081f12927ae7906d90d6623534 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 25 Mar 2015 00:05:38 +0100 Subject: fstab-generator: don't accept missing root=, but accept root=none And other non-device entries (like fstab does). Mount whatever the user asked to be mounted on / on the kernel command line. Do less sanity check and do *not* bail out when the mount device looks strange or does not exist. This basically makes the changes for deviceless filesystems from yesterday unnecessary and is in line with what we do for filesystems set up in fstab. Remove some code that is now dead (reverting fb02a2775a65 and b0438462). [tomegun: - change patch title/description a bit. - don't touch the /usr logic, that would be a separate change and we don't currently have a convincing use-case for that. - don't bail out on /sys ro. This only makes sense in containers, where we would not be doing this anyway. If there is a use-case we could consider that as a separate patch.] --- src/fstab-generator/fstab-generator.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'src/fstab-generator') diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index 77c97fdb29..cd1478e54d 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -397,22 +397,15 @@ static int add_root_mount(void) { _cleanup_free_ char *what = NULL; const char *opts; - if (fstype_is_deviceless(arg_root_fstype)) { - if (free_and_strdup(&what, arg_root_what) < 0) - return log_oom(); - } else { - if (isempty(arg_root_what)) { - log_debug("Could not find a root= entry on the kernel command line."); - return 0; - } - - what = fstab_node_to_udev_node(arg_root_what); - if (!path_is_absolute(what)) { - log_debug("Skipping entry what=%s where=/sysroot type=%s", what, strna(arg_root_fstype)); - return 0; - } + if (isempty(arg_root_what)) { + log_debug("Could not find a root= entry on the kernel command line."); + return 0; } + what = fstab_node_to_udev_node(arg_root_what); + if (!what) + log_oom(); + if (!arg_root_options) opts = arg_root_rw > 0 ? "rw" : "ro"; else if (arg_root_rw >= 0 || @@ -426,7 +419,7 @@ static int add_root_mount(void) { "/sysroot", arg_root_fstype, opts, - 1, + is_device_path(what) ? 1 : 0, false, false, false, -- cgit v1.2.3-54-g00ecf