Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: client/site_tests/factory_Wipe/src/switch_partitions.sh

Issue 3362018: Kill factory partition dead. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git
Patch Set: . Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/site_tests/factory_Wipe/factory_Wipe.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/site_tests/factory_Wipe/src/switch_partitions.sh
diff --git a/client/site_tests/factory_Wipe/src/switch_partitions.sh b/client/site_tests/factory_Wipe/src/switch_partitions.sh
index 1e0dea9fd54bb84cd560fb210eb95caf265653a5..4563fa634d4dbf71ea207a6d09d417ea05c64188 100755
--- a/client/site_tests/factory_Wipe/src/switch_partitions.sh
+++ b/client/site_tests/factory_Wipe/src/switch_partitions.sh
@@ -15,6 +15,10 @@ then
exit 1
fi
+DEV=${ROOT_DEV%[0-9]}
+# Note: this works only for single digit partition numbers.
+ROOT_PART=$(echo "${ROOT_DEV}" | sed -e 's/^.*\([0-9]\)$/\1/')
hungte 2010/09/13 02:37:32 sed -e 's/.*[^0-9]//' would be simpler.
+
# Successfully being able to mount the other partition
# and run postinst guarantees that there is a real partition there.
echo "Running postinst on $OTHER_ROOT_DEV"
@@ -26,4 +30,14 @@ POSTINST_RETURN_CODE=$?
umount "$MOUNTPOINT"
rmdir "$MOUNTPOINT"
+# Destroy this root partition if we've successfully switched.
+if [ "${POSTINST_RETURN_CODE}" = "0" ]; then
+ cgpt add -i "$((${ROOT_PART} - 1))" -P 0 -S 0 -T 0 "${DEV}"
+ RC=$?
+ if [ "${RC}" != "0" ]; then
+ echo "Failed to run cgpt"
+ return 1
+ fi
+fi
+
exit $POSTINST_RETURN_CODE
« no previous file with comments | « client/site_tests/factory_Wipe/factory_Wipe.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698