]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared: Don't try to generate read-only filesystem that we don't support 24794/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 23 Sep 2022 07:55:26 +0000 (09:55 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 23 Sep 2022 07:55:26 +0000 (09:55 +0200)
We need explicit support to generate read-only filesystems, since we
always need to pass a source tree to the mkfs binary to populate the
filesystem. As such, let's add an explicit check to return a
recognizable error when users try to generate a read-only filesystem
that we don't support.

src/shared/mkfs-util.c

index c8e31aeb96e0f50bee9772d91278b43bdac283a2..8161dbf825fb8b52e81249b12f8e6f75b2001ced 100644 (file)
@@ -123,6 +123,10 @@ int make_filesystem(
                         return log_error_errno(SYNTHETIC_ERRNO(EPROTONOSUPPORT), "mksquashfs binary not available.");
                 if (r < 0)
                         return log_error_errno(r, "Failed to determine whether mksquashfs binary exists: %m");
+        } else if (fstype_is_ro(fstype)) {
+                return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
+                                                       "Don't know how to create read-only file system '%s', refusing.",
+                                                       fstype);
         } else {
                 if (root)
                         return log_error_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),