AU: recommend cgpt undo on update_engine_client -reset_status

While -reset_status will reset the update engine's internal state, as
well as remove the flag file that necessitates a reboot, it will not
undo the (potentially detrimental) effect of an update to a machine's
partition table. With this change, update_engine_client now prompts the
user to apply a one-liner shell command to reverse the impact of such
changes, ensuring that a subsequent reboot will load the current
kernel/rootfs (and not the updated ones).

Note that this command should work regardless of which physical device
is the boot device (e.g. /dev/sda, /dev/mmcblk0) and the partition
scheme used (rootfs is e.g. /dev/sda3, /dev/mmcblk0p3). It does,
however, assume that the number of the kernel partition is that of the
corresponding rootfs partition minus one.

BUG=None
TEST=Expected log message displayed

Change-Id: I4503c4377a9ddbfd597ac7e049fad72ba989a213
Reviewed-on: https://gerrit.chromium.org/gerrit/42022
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
diff --git a/update_engine_client.cc b/update_engine_client.cc
index 1f3dc34..f3b5eea 100644
--- a/update_engine_client.cc
+++ b/update_engine_client.cc
@@ -278,7 +278,9 @@
       return 1;
     }
 
-    LOG(INFO) << "ResetStatus succeeded.";
+    LOG(INFO) << "ResetStatus succeeded; to undo partition table changes run:\n"
+                 "(D=$(rootdev -d) P=$(rootdev -s); cgpt p -i$(($(echo ${P#$D} "
+                 "| sed 's/^[^0-9]*//')-1)) $D;)";
     return 0;
   }