remount: Don't overwrite /run/ostree-booted
authorColin Walters <walters@verbum.org>
Thu, 13 Jul 2023 11:28:07 +0000 (07:28 -0400)
committerColin Walters <walters@verbum.org>
Thu, 13 Jul 2023 11:28:39 +0000 (07:28 -0400)
Since it should always be written in the initramfs.

src/switchroot/ostree-remount.c

index 80f8ad346a810b6bb4c99235f4f0bb28943f5a62..2563d08bb16d9e2085f6c16c5f35fd962287b36a 100644 (file)
@@ -81,10 +81,15 @@ do_remount (const char *target, bool writable)
 int
 main (int argc, char *argv[])
 {
-  /* When systemd is in use this is normally created via the generator, but
-   * we ensure it's created here as well for redundancy.
+  /* We really expect that nowadays that everything is done in the initramfs,
+   * but historically we created this file here, so we'll continue to do be
+   * sure here it exists.  This code should be removed at some point though.
    */
-  touch_run_ostree ();
+  {
+    int fd = open (OSTREE_PATH_BOOTED, O_EXCL | O_CREAT | O_WRONLY | O_NOCTTY | O_CLOEXEC, 0640);
+    if (fd != -1)
+      (void)close (fd);
+  }
 
   /* The /sysroot mount needs to be private to avoid having a mount for e.g. /var/cache
    * also propagate to /sysroot/ostree/deploy/$stateroot/var/cache