mirror of
https://github.com/ostreedev/ostree.git
synced 2025-03-11 20:58:45 +03:00
ostree-remount: Don't skip remount if root is composefs
When using composefs the root fs will always be read-only, but in this case we should still continue remounting /sysroot. So, we record a /run/ostree-composefs-root.stamp file in ostree-prepare-root if composefs is used, and then react to it in ostree-remount.
This commit is contained in:
parent
d47a90347b
commit
f9bdc66649
@ -32,6 +32,7 @@
|
||||
|
||||
#define INITRAMFS_MOUNT_VAR "/run/ostree/initramfs-mount-var"
|
||||
#define _OSTREE_SYSROOT_READONLY_STAMP "/run/ostree-sysroot-ro.stamp"
|
||||
#define _OSTREE_COMPOSEFS_ROOT_STAMP "/run/ostree-composefs-root.stamp"
|
||||
|
||||
static inline int
|
||||
path_is_on_readonly_fs (const char *path)
|
||||
|
@ -330,7 +330,14 @@ main (int argc, char *argv[])
|
||||
err (EXIT_FAILURE, "Failed to mount composefs");
|
||||
}
|
||||
else
|
||||
using_composefs = 1;
|
||||
{
|
||||
int fd = open (_OSTREE_COMPOSEFS_ROOT_STAMP, O_WRONLY | O_CREAT | O_CLOEXEC, 0644);
|
||||
if (fd < 0)
|
||||
err (EXIT_FAILURE, "failed to create %s", _OSTREE_COMPOSEFS_ROOT_STAMP);
|
||||
(void)close (fd);
|
||||
|
||||
using_composefs = 1;
|
||||
}
|
||||
#else
|
||||
err (EXIT_FAILURE, "Composefs not supported");
|
||||
#endif
|
||||
|
@ -95,7 +95,12 @@ main (int argc, char *argv[])
|
||||
if (mount ("none", "/sysroot", NULL, MS_REC | MS_PRIVATE, NULL) < 0)
|
||||
perror ("warning: While remounting /sysroot MS_PRIVATE");
|
||||
|
||||
if (path_is_on_readonly_fs ("/"))
|
||||
bool root_is_composefs = false;
|
||||
struct stat stbuf;
|
||||
if (fstatat (AT_FDCWD, _OSTREE_COMPOSEFS_ROOT_STAMP, &stbuf, 0) == 0)
|
||||
root_is_composefs = true;
|
||||
|
||||
if (path_is_on_readonly_fs ("/") && !root_is_composefs)
|
||||
{
|
||||
/* If / isn't writable, don't do any remounts; we don't want
|
||||
* to clear the readonly flag in that case.
|
||||
|
Loading…
x
Reference in New Issue
Block a user