Skip to content

Commit

Permalink
switchroot: Move late /run/ostree-booted creation to ostree-system-ge…
Browse files Browse the repository at this point in the history
…nerator

When ostree-prepare-root is pid 1, ostree-prepare-boot defers creation of
/run/ostree-booted, which we were doing in ostree-remount, but that's too
late if we need ostree-system-generator to bind /var. Move the creation
of the /run/ostree-booted marker to ostree-system-generator based on the
existence of the ostree= kernel command line argument (which matches the
condition that ostree-remount used).

Signed-off-by: Alex Kiernan <[email protected]>
  • Loading branch information
Alex Kiernan authored and akiernan committed Jul 7, 2018
1 parent eeacbc6 commit 587bb67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/switchroot/ostree-prepare-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ main(int argc, char *argv[])


/* We only stamp /run now if we're running in an initramfs, i.e. we're
* not pid 1. Otherwise it's handled later via ostree-remount.service.
* not pid 1. Otherwise it's handled later via ostree-system-generator.
* https://mail.gnome.org/archives/ostree-list/2018-March/msg00012.html
*/
if (!running_as_pid1)
Expand Down
10 changes: 0 additions & 10 deletions src/switchroot/ostree-remount.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ main(int argc, char *argv[])
struct stat stbuf;
int i;

/* See comments in ostree-prepare-root.c for this.
*
* This service is triggered via
* ConditionKernelCommandLine=ostree
* but it's a lot easier for various bits of userspace to check for
* a file versus parsing the kernel cmdline. So let's ensure
* the stamp file is created here too.
*/
touch_run_ostree ();

/* 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
*
Expand Down
16 changes: 8 additions & 8 deletions src/switchroot/ostree-system-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@ static const char *arg_dest_late = "/tmp";
int
main(int argc, char *argv[])
{
/* Important: if this isn't an ostree-booted system, do nothing; people could
* have the package installed as a dependency for flatpak or whatever.
*/
{ struct stat stbuf;
if (fstatat (AT_FDCWD, "/run/ostree-booted", &stbuf, 0) < 0)
exit (EXIT_SUCCESS);
}

/* We conflict with the magic ostree-mount-deployment-var file for ostree-prepare-root */
{ struct stat stbuf;
if (fstatat (AT_FDCWD, INITRAMFS_MOUNT_VAR, &stbuf, 0) == 0)
Expand All @@ -71,6 +63,14 @@ main(int argc, char *argv[])
if (!ostree_cmdline)
errx (EXIT_FAILURE, "Failed to find ostree= kernel argument");

This comment has been minimized.

Copy link
@akiernan

akiernan Jul 8, 2018

Contributor

Something I wasn't clear on, would this need changing to EXIT_SUCCESS if this patch moves forward?


/* See comments in ostree-prepare-root.c for this.
*
* It's a lot easier for various bits of userspace to check for
* a file versus parsing the kernel cmdline. So let's ensure
* the stamp file is created here too.
*/
touch_run_ostree ();

{ g_autoptr(GError) local_error = NULL;
if (!ostree_cmd__private__()->ostree_system_generator (ostree_cmdline, arg_dest, NULL, arg_dest_late, &local_error))
errx (EXIT_FAILURE, "%s", local_error->message);
Expand Down

0 comments on commit 587bb67

Please sign in to comment.