Index: src/platform/update_engine/utils.cc |
diff --git a/src/platform/update_engine/utils.cc b/src/platform/update_engine/utils.cc |
index 83096d28378698df786e0b3aebdb54223ffad27b..b19e6fc112ea29b2b74397970fd6da3e87965720 100644 |
--- a/src/platform/update_engine/utils.cc |
+++ b/src/platform/update_engine/utils.cc |
@@ -195,6 +195,30 @@ bool RecursiveUnlinkDir(const std::string& path) { |
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 @@ bool UnmountFilesystem(const string& mountpoint) { |
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."; |