Implement Rollback to previously booted partitions.

This CL implements rollback to whatever partition we ran from before.
We expose this functionality via dbus under AttemptRollback and expose
a new command-line option to update_engine_client that a developer can
use.

BUG=chromium:242665
TEST=Unittests, full update, update + rollback and verified.

Change-Id: Ie59f90b9a0b777dc1329592449090c70892236bf
Reviewed-on: https://gerrit.chromium.org/gerrit/58427
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/omaha_response_handler_action.cc b/omaha_response_handler_action.cc
index c876d94..358988c 100644
--- a/omaha_response_handler_action.cc
+++ b/omaha_response_handler_action.cc
@@ -72,7 +72,7 @@
   }
   install_plan_.is_full_update = !response.is_delta_payload;
 
-  TEST_AND_RETURN(GetInstallDev(
+  TEST_AND_RETURN(utils::GetInstallDev(
       (!boot_device_.empty() ? boot_device_ : utils::BootDevice()),
       &install_plan_.install_path));
   install_plan_.kernel_install_path =
@@ -104,18 +104,6 @@
   completer.set_code(kErrorCodeSuccess);
 }
 
-bool OmahaResponseHandlerAction::GetInstallDev(const std::string& boot_dev,
-                                               std::string* install_dev) {
-  TEST_AND_RETURN_FALSE(utils::StringHasPrefix(boot_dev, "/dev/"));
-  string ret(boot_dev);
-  string::reverse_iterator it = ret.rbegin();  // last character in string
-  // Right now, we just switch '3' and '5' partition numbers.
-  TEST_AND_RETURN_FALSE((*it == '3') || (*it == '5'));
-  *it = (*it == '3') ? '5' : '3';
-  *install_dev = ret;
-  return true;
-}
-
 bool OmahaResponseHandlerAction::AreHashChecksMandatory(
     const OmahaResponse& response) {
   // All our internal testing uses dev server which doesn't generate metadata