[ostree] switchroot: Bind mount /lib/modules from /ostree/modules



commit fcd70e5891440f70473e4642d6afbc98b057e292
Author: Colin Walters <walters verbum org>
Date:   Fri Feb 10 19:17:29 2012 -0500

    switchroot: Bind mount /lib/modules from /ostree/modules
    
    Since we have kernels outside of the tree, keep modules outside
    too.

 src/switchroot/ostree-switch-root.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/switchroot/ostree-switch-root.c b/src/switchroot/ostree-switch-root.c
index 54c0495..3e1155c 100644
--- a/src/switchroot/ostree-switch-root.c
+++ b/src/switchroot/ostree-switch-root.c
@@ -153,6 +153,7 @@ main(int argc, char *argv[])
   const char *initramfs_move_mounts[] = { "/dev", "/proc", "/sys", "/run", NULL };
   const char *toproot_bind_mounts[] = { "/home", "/root", "/tmp", NULL };
   const char *ostree_bind_mounts[] = { "/var", NULL };
+  /* ostree_readonly_bind_mounts /lib/modules -> modules */
   const char *readonly_bind_mounts[] = { "/bin", "/etc", "/lib", "/sbin", "/usr",
 					 NULL };
   const char *root_mountpoint = NULL;
@@ -282,6 +283,14 @@ main(int argc, char *argv[])
 	}
     }
 
+  snprintf (srcpath, sizeof(srcpath), "/ostree/modules");
+  snprintf (destpath, sizeof(destpath), "/ostree/%s/lib/modules", ostree_target);
+  if (mount (srcpath, destpath, NULL, MS_MGC_VAL|MS_BIND, NULL) < 0)
+    {
+      perrorv ("failed to bind mount (class:bind) %s to %s", srcpath, destpath);
+      exit (1);
+    }
+
   for (i = 0; readonly_bind_mounts[i] != NULL; i++)
     {
       snprintf (destpath, sizeof(destpath), "/ostree/%s%s", ostree_target, readonly_bind_mounts[i]);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]