From 77acad246e104a1e553dad4c86ab333e884f8df5 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 13 Jul 2023 07:28:07 -0400 Subject: [PATCH] remount: Don't overwrite /run/ostree-booted Since it should always be written in the initramfs. --- src/switchroot/ostree-remount.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/switchroot/ostree-remount.c b/src/switchroot/ostree-remount.c index 80f8ad34..2563d08b 100644 --- a/src/switchroot/ostree-remount.c +++ b/src/switchroot/ostree-remount.c @@ -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 -- 2.30.2