mirror of
https://github.com/ostreedev/ostree.git
synced 2025-02-13 01:57:52 +03:00
sysroot: Track whether /run/ostree-booted exists
Prep for further work around deployment staging. Closes: #1497 Approved by: jlebon
This commit is contained in:
parent
792c190a44
commit
bb9cc8912a
@ -50,6 +50,7 @@ struct OstreeSysroot {
|
||||
GLnxLockFile lock;
|
||||
|
||||
gboolean loaded;
|
||||
gboolean ostree_booted;
|
||||
|
||||
gboolean is_physical; /* TRUE if we're pointed at physical storage root and not a deployment */
|
||||
GPtrArray *deployments;
|
||||
|
@ -797,6 +797,16 @@ ostree_sysroot_load_if_changed (OstreeSysroot *self,
|
||||
if (!ensure_repo (self, error))
|
||||
return FALSE;
|
||||
|
||||
/* If we didn't check already, see if we have the global ostree-booted flag;
|
||||
* we'll use it to sanity check that we found a booted deployment for example.
|
||||
*/
|
||||
if (!self->loaded)
|
||||
{
|
||||
if (!glnx_fstatat_allow_noent (AT_FDCWD, "/run/ostree-booted", NULL, 0, error))
|
||||
return FALSE;
|
||||
self->ostree_booted = (errno == 0);
|
||||
}
|
||||
|
||||
int bootversion = 0;
|
||||
if (!read_current_bootversion (self, &bootversion, cancellable, error))
|
||||
return FALSE;
|
||||
@ -852,6 +862,9 @@ ostree_sysroot_load_if_changed (OstreeSysroot *self,
|
||||
if (!find_booted_deployment (self, deployments, &self->booted_deployment,
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
/* Sanity check; note the converse case is fine */
|
||||
if (self->booted_deployment && !self->ostree_booted)
|
||||
return glnx_throw (error, "Unexpected state: In a booted deployment but no /run/ostree-booted?");
|
||||
|
||||
/* Determine whether we're "physical" or not, the first time we initialize */
|
||||
if (!self->loaded)
|
||||
|
Loading…
x
Reference in New Issue
Block a user