block: get mountpoints from /proc/self/mountinfo
[project/fstools.git] / mount_root.c
index 7b69c7f..6e06b45 100644 (file)
@@ -12,6 +12,9 @@
  */
 
 #include <sys/mount.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -29,8 +32,9 @@ start(int argc, char *argv[1])
 {
        struct volume *root;
        struct volume *data = volume_find("rootfs_data");
+       struct stat s;
 
-       if (!getenv("PREINIT"))
+       if (!getenv("PREINIT") && stat("/tmp/.preinit", &s))
                return -1;
 
        if (!data) {
@@ -117,6 +121,8 @@ int main(int argc, char **argv)
 {
        if (argc < 2)
                return start(argc, argv);
+       if (!strcmp(argv[1], "ram"))
+               return ramoverlay();
        if (!strcmp(argv[1], "stop"))
                return stop(argc, argv);
        if (!strcmp(argv[1], "done"))