Skip to content

Instantly share code, notes, and snippets.

@dsd

dsd/ostree.patch Secret

Created July 20, 2015 20:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsd/0de2ca533c66daa3a733 to your computer and use it in GitHub Desktop.
Save dsd/0de2ca533c66daa3a733 to your computer and use it in GitHub Desktop.
ostree-prepare-root: set up /boot bind mount when the bootloader config appears to be on the same partition
--- ostree-2015.7+dev28.77069fa/src/switchroot/ostree-prepare-root.c.orig 2015-07-20 13:56:13.138032662 -0600
+++ ostree-2015.7+dev28.77069fa/src/switchroot/ostree-prepare-root.c 2015-07-20 14:19:13.090046848 -0600
@@ -194,6 +194,23 @@
exit (EXIT_FAILURE);
}
+ /* If /boot is on the same partition, use a bind mount to make it visible
+ * at /boot inside the deployment. */
+ snprintf (srcpath, sizeof(srcpath), "%s/boot/loader", root_mountpoint);
+ if (lstat (srcpath, &stbuf) == 0 && S_ISLNK (stbuf.st_mode))
+ {
+ snprintf (destpath, sizeof(destpath), "%s/boot", newroot);
+ if (lstat (destpath, &stbuf) == 0 && S_ISDIR (stbuf.st_mode))
+ {
+ snprintf (srcpath, sizeof(srcpath), "%s/boot", root_mountpoint);
+ if (mount (srcpath, destpath, NULL, MS_BIND, NULL) < 0)
+ {
+ perrorv ("failed to bind mount %s to %s", srcpath, destpath);
+ exit (EXIT_FAILURE);
+ }
+ }
+ }
+
/* Set up any read-only bind mounts (notably /usr) */
for (i = 0; readonly_bind_mounts[i] != NULL; i++)
{
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment