pub(crate) fn validate_update(
storage: &Storage,
booted_cfs: &BootedComposefs,
host: &Host,
img_digest: &str,
config_verity: &Sha512HashValue,
is_switch: bool,
) -> Result<UpdateAction>Expand description
Determines what action should be taken for the update
Cases:
-
The verity is the same as that of the currently booted deployment
Nothing to do here as we’re currently booted
-
The verity is the same as that of the staged deployment
Nothing to do, as we only get a “staged” deployment if we have /run/composefs/staged-deployment which is the last thing we create while upgrading
-
The verity is the same as that of the rollback deployment
Nothing to do since this is a rollback deployment which means this was unstaged at some point
-
The verity is not found
The update/switch might’ve been canceled before /run/composefs/staged-deployment was created, or at any other point in time, or it’s a new one. Any which way, we can overwrite everything
§Arguments
storage- The global storage objectbooted_cfs- Reference to the booted composefs deploymenthost- Object returned byget_composefs_statusimg_digest- The SHA256 sum of the target imageconfig_verity- The verity of the Image config splitstreamis_switch- Whether this is an update operation or a switch operation
§Returns
- UpdateAction::Skip - Skip the update/switch as we have it as a deployment
- UpdateAction::UpdateOrigin - Just update the target imgref in the origin file
- UpdateAction::Proceed - Proceed with the update