summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2021-11-01 09:58:06 -0400
committerGitHub <noreply@github.com>2021-11-01 09:58:06 -0400
commit800289a8dbc8222c9e5da86f9f60eaf5dcf6201f (patch)
treea8be3c8abfd36b01493b8cb15861922b39f92043
parentb7efd16cc5e1555ca4aca42fa17a6f0565b7c647 (diff)
parent63d0c4c78130154c95c6a8ff1fb231936d9fa607 (diff)
downloadostree-800289a8dbc8222c9e5da86f9f60eaf5dcf6201f.tar.gz
Merge pull request #2475 from lucab/ups/prepare-root-check-first
prepare-root: check for read-only sysroot status early on
-rw-r--r--src/switchroot/ostree-prepare-root.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
index aa7d5a4e..a99d884d 100644
--- a/src/switchroot/ostree-prepare-root.c
+++ b/src/switchroot/ostree-prepare-root.c
@@ -216,6 +216,20 @@ main(int argc, char *argv[])
err (EXIT_FAILURE, "failed to umount proc from /proc");
}
+ /* Query the repository configuration - this is an operating system builder
+ * choice. More info: https://github.com/ostreedev/ostree/pull/1767
+ */
+ const bool sysroot_readonly = sysroot_is_configured_ro (root_arg);
+ const bool sysroot_currently_writable = !path_is_on_readonly_fs (root_arg);
+#ifdef USE_LIBSYSTEMD
+ sd_journal_send ("MESSAGE=filesystem at %s currently writable: %d", root_arg,
+ (int)sysroot_currently_writable,
+ NULL);
+ sd_journal_send ("MESSAGE=sysroot.readonly configuration value: %d",
+ (int)sysroot_readonly,
+ NULL);
+#endif
+
/* Work-around for a kernel bug: for some reason the kernel
* refuses switching root if any file systems are mounted
* MS_SHARED. Hence remount them MS_PRIVATE here as a
@@ -235,20 +249,6 @@ main(int argc, char *argv[])
if (chdir (deploy_path) < 0)
err (EXIT_FAILURE, "failed to chdir to deploy_path");
- /* Query the repository configuration - this is an operating system builder
- * choice. More info: https://github.com/ostreedev/ostree/pull/1767
- */
- const bool sysroot_readonly = sysroot_is_configured_ro (root_arg);
- const bool sysroot_currently_writable = !path_is_on_readonly_fs (root_arg);
-#ifdef USE_LIBSYSTEMD
- sd_journal_send ("MESSAGE=filesystem at %s currently writable: %d", root_arg,
- (int)sysroot_currently_writable,
- NULL);
- sd_journal_send ("MESSAGE=sysroot.readonly configuration value: %d",
- (int)sysroot_readonly,
- NULL);
-#endif
-
if (sysroot_readonly)
{
if (!sysroot_currently_writable)