Chromium Code Reviews| 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 |