snapshotctl: Add apply-update option

$snapshotctl apply-update <directory containing snapshot patches>

This command is equivalent to applying incremental-ota but
bypasses all of the update-engine subsystem. Snapshot-patches
which are created on the host will be used directly and
will be written to the COW block devices.

No change to any of the libsnapshot or the I/O path logic.

Once the snapshot patches are applied, device is ready
to reboot as if an OTA update is applied.

Once the device reboots, snapshot merge will be initiated
as usual.

This will help test the changes to libsnapshot + init + snapuserd
extremely quick.

Incremental flashing becomes quite simple in the CI workflow.

Here are numbers tested on live builds where the actual builds/testing
is done on CI.

Patch-Create+Apply = Create the snapshot patches between two
builds and apply them to the device

Branch(main)     Patch-Creation+Apply Merge        Snapshot-size
=================================================================
Build-1 -> Build-2  14 seconds        40 seconds   160MB

Build-2 -> Build-3  21 seconds        26 seconds   331MB

Build-3 -> Build-4  30 seconds        45 seconds   375MB

Build-X -> Build-X  3 seconds	       4 seconds   8MB

Bug: 319309466
Test: On Pixel 6, incremental builds

Change-Id: I271b2cb5df4abde91571ec70ce06f926a1d01694
Signed-off-by: Akilesh Kailash <akailash@google.com>
1 file changed