apply-update: Add option to boot device off snapshots
$apply_update --boot_snapshot
~20 seconds to boot off the snapshots
To revert back to original state:
`adb shell snapshotctl revert-snapshots`
Bug: 400723109
Test: apply_update --boot_snapshot
Change-Id: Ia71c93b606149f0f0824085b50a9dc9e76ac5d2a
Signed-off-by: Akilesh Kailash <akailash@google.com>
diff --git a/fs_mgr/libsnapshot/scripts/apply-update.sh b/fs_mgr/libsnapshot/scripts/apply-update.sh
index 2a5a8a2..92bff3b 100755
--- a/fs_mgr/libsnapshot/scripts/apply-update.sh
+++ b/fs_mgr/libsnapshot/scripts/apply-update.sh
@@ -99,6 +99,8 @@
Now, the script can safely use this flag for update purpose.
--wipe Wipe user data during the update.
+ --boot_snapshot Boot the device off snapshots - No data wipe is supported
+ To revert back to original state - `adb shell snapshotctl revert-snapshots`
--help Display this help message.
Environment Variables:
@@ -123,6 +125,7 @@
}
skip_static_partitions=0
+boot_snapshot=0
flash_bootloader=1
wipe_flag=0
help_flag=0
@@ -139,6 +142,9 @@
--skip_bootloader)
flash_bootloader=0
;;
+ --boot_snapshot)
+ boot_snapshot=1
+ ;;
--help)
help_flag=1
;;
@@ -208,7 +214,9 @@
log_message "Applying update"
-if (( wipe_flag )); then
+if (( boot_snapshot)); then
+ adb shell snapshotctl map-snapshots $DEVICE_PATH
+elif (( wipe_flag )); then
adb shell snapshotctl apply-update $DEVICE_PATH -w
else
adb shell snapshotctl apply-update $DEVICE_PATH