]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
gpt-generator: Find device on a stateless system
authorTobias Hunger <tobias.hunger@gmail.com>
Fri, 10 Apr 2015 23:52:50 +0000 (01:52 +0200)
committerLennart Poettering <lennart@poettering.net>
Sun, 12 Apr 2015 18:00:21 +0000 (20:00 +0200)
A stateless system has a tmpfs as root file system. That obviously
does not have any block device associated with it. So try falling back
to the device of the /usr filesystem if the root filesystem fails.

src/gpt-auto-generator/gpt-auto-generator.c

index 99dc50fe3c3aa3cfe6159a9f25d8755cd594f0b2..96a8447efd3022fe63bfb424303a447ac74d16b9 100644 (file)
@@ -658,8 +658,13 @@ static int add_mounts(void) {
         if (r < 0)
                 return log_error_errno(r, "Failed to determine block device of root file system: %m");
         else if (r == 0) {
-                log_debug("Root file system not on a (single) block device.");
-                return 0;
+                r = get_block_device("/usr", &devno);
+                if (r < 0)
+                        return log_error_errno(r, "Failed to determine block device of /usr file system: %m");
+                else if (r == 0) {
+                        log_debug("Neither root nor /usr file system are on a (single) block device.");
+                        return 0;
+                }
         }
 
         return enumerate_partitions(devno);