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.h b/utils.h
index e5d099f..c6edb7d 100644
--- a/utils.h
+++ b/utils.h
@@ -77,12 +77,28 @@
// This WILL cross filesystem boundaries.
bool RecursiveUnlinkDir(const std::string& path);
+// Returns the root device for a partition. For example,
+// RootDevice("/dev/sda3") returns "/dev/sda".
+std::string RootDevice(const std::string& partition_device);
+
+// Returns the partition number, as a string, of partition_device. For example,
+// PartitionNumber("/dev/sda3") return "3".
+std::string PartitionNumber(const std::string& partition_device);
+
// Synchronously mount or unmount a filesystem. Return true on success.
// Mounts as ext3 with default options.
bool MountFilesystem(const std::string& device, const std::string& mountpoint,
unsigned long flags);
bool UnmountFilesystem(const std::string& mountpoint);
+enum BootLoader {
+ BootLoader_SYSLINUX = 0,
+ BootLoader_CHROME_FIRMWARE = 1
+};
+// Detects which bootloader this system uses and returns it via the out
+// param. Returns true on success.
+bool GetBootloader(BootLoader* out_bootloader);
+
// Returns the error message, if any, from a GError pointer.
const char* GetGErrorMessage(const GError* error);