Skip to content

Commit

Permalink
lib/deploy: Support gating deployment finalization
Browse files Browse the repository at this point in the history
Teach `ostree-finalize-staged.service` to check for a file in `/run` to
determine if it should do the finalization. This will be used in
RPM-OSTree, where we want to be able to separate out "preparing updates"
from "making update the default" for more fine-grained control. See:
coreos/rpm-ostree#1748
  • Loading branch information
jlebon committed Apr 17, 2019
1 parent 85245fa commit 094ef46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/libostree/ostree-sysroot-deploy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2885,6 +2885,17 @@ _ostree_sysroot_finalize_staged (OstreeSysroot *self,
return TRUE;
}

/* Check if finalization is gated. */
if (!glnx_fstatat_allow_noent (AT_FDCWD, _OSTREE_SYSROOT_RUNSTATE_STAGED_LOCKED,
NULL, 0, error))
return FALSE;
if (errno == 0)
{
ot_journal_print (LOG_INFO, "Not finalizing; found "
_OSTREE_SYSROOT_RUNSTATE_STAGED_LOCKED);
return TRUE;
}

/* Notice we send this *after* the trivial `return TRUE` above; this msg implies we've
* committed to finalizing the deployment. */
ot_journal_send ("MESSAGE_ID=" SD_ID128_FORMAT_STR,
Expand Down
1 change: 1 addition & 0 deletions src/libostree/ostree-sysroot-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct OstreeSysroot {
#define OSTREE_SYSROOT_LOCKFILE "ostree/lock"
/* We keep some transient state in /run */
#define _OSTREE_SYSROOT_RUNSTATE_STAGED "/run/ostree/staged-deployment"
#define _OSTREE_SYSROOT_RUNSTATE_STAGED_LOCKED "/run/ostree/staged-deployment-locked"
#define _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_DIR "/run/ostree/deployment-state/"
#define _OSTREE_SYSROOT_DEPLOYMENT_RUNSTATE_FLAG_DEVELOPMENT "unlocked-development"

Expand Down

0 comments on commit 094ef46

Please sign in to comment.