AU: Many minor cleanup changes

postinstall: Run postinst twice, once for pre-commit (ie, before we
mark the install partition bootable in the partition table), and
post-commit (for after we do). This behavior is needed for specific
types of firmware update.

download action: flush caches, as we found was necessary in
memento_updater.sh

omaha request prep action: update the names of keys we look for in
lsb-release, also get the AU server url from a file, rather than
hard-code it.

set bootable flag action: GPT support.

also, some misc utility functions.

BUG=None
TEST=attached unittests

Review URL: http://codereview.chromium.org/1881001
diff --git a/utils.cc b/utils.cc
index 83096d2..b19e6fc 100644
--- a/utils.cc
+++ b/utils.cc
@@ -195,6 +195,30 @@
   return true;
 }
 
+string RootDevice(const string& partition_device) {
+  CHECK(!partition_device.empty());
+  string::const_iterator it = --partition_device.end();
+  for (; it >= partition_device.begin(); --it) {
+    if (!isdigit(*it))
+      break;
+  }
+  // Some devices contain a p before the partitions. For example:
+  // /dev/mmc0p4 should be shortened to /dev/mmc0.
+  if (*it == 'p')
+    --it;
+  return string(partition_device.begin(), it + 1);
+}
+
+string PartitionNumber(const string& partition_device) {
+  CHECK(!partition_device.empty());
+  string::const_iterator it = --partition_device.end();
+  for (; it >= partition_device.begin(); --it) {
+    if (!isdigit(*it))
+      break;
+  }
+  return string(it + 1, partition_device.end());
+}
+
 std::string ErrnoNumberAsString(int err) {
   char buf[100];
   buf[0] = '\0';
@@ -357,6 +381,12 @@
   return true;
 }
 
+bool GetBootloader(BootLoader* out_bootloader) {
+  // For now, hardcode to syslinux.
+  *out_bootloader = BootLoader_SYSLINUX;
+  return true;
+}
+
 const char* GetGErrorMessage(const GError* error) {
   if (!error)
     return "Unknown error.";