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 4563fa634d4dbf71ea207a6d09d417ea05c64188..cf5216644a4348ef043bbc56e1cc4d675a6c0ee4 100755 |
--- a/client/site_tests/factory_Wipe/src/switch_partitions.sh |
+++ b/client/site_tests/factory_Wipe/src/switch_partitions.sh |
@@ -18,6 +18,7 @@ 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/') |
+OTHER_ROOT_PART=$(echo "${OTHER_ROOT_DEV}" | sed -e 's/^.*\([0-9]\)$/\1/') |
# Successfully being able to mount the other partition |
# and run postinst guarantees that there is a real partition there. |
@@ -33,8 +34,12 @@ 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 |
+ if [ "$?" != "0" ]; then |
+ echo "Failed to run cgpt" |
+ return 1 |
+ fi |
+ cgpt add -i "$((${OTHER_ROOT_PART} - 1))" -P 3 -S 1 -T 0 "${DEV}" |
+ if [ "$?" != "0" ]; then |
echo "Failed to run cgpt" |
return 1 |
fi |