update_engine: Allow `cros flash` on base images.
A goal of the upcoming debugd dev tools (crbug.com/403170), is to
enable a path to modify a base image such that a developer could run
`cros flash` on it.
Currently update_engine disallows custom omaha URLs and forces a hash
check for base builds, which breaks `cros flash`. This CL relaxes the
restriction slightly to allow use on a base build as long as the system
is in dev mode and the debugd dev tools are also enabled (dev tools are
currently enabled only in dev mode when there is no owner).
The check is done in update_attempter.cc, which only allows an unofficial
Omaha URL if these conditions hold true (unofficial meaning not the main
AU server or the AU test server). The other main change is
AreHashChecksMandatory() in omaha_response_handler_action.cc, which now
allows skipping hash checks for unofficial Omaha URLs.
BUG=chromium:428053
TEST=Ran unit tests, `cros flash` on base images in various states.
CQ-DEPEND=CL:227431
Change-Id: I8583ce6aa70feac8fe74b7a3992e8a4e761833c3
Reviewed-on: https://chromium-review.googlesource.com/228293
Reviewed-by: Alex Deymo <deymo@chromium.org>
Trybot-Ready: David Pursell <dpursell@chromium.org>
Commit-Queue: David Pursell <dpursell@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
diff --git a/omaha_request_params.h b/omaha_request_params.h
index 0657649..345f5c2 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -19,7 +19,10 @@
namespace chromeos_update_engine {
// The default "official" Omaha update URL.
-extern const char* const kProductionOmahaUrl;
+extern const char kProductionOmahaUrl[];
+
+// The autoupdate test Omaha update URL.
+extern const char kAUTestOmahaUrl[];
class SystemState;
@@ -176,12 +179,13 @@
virtual std::string GetAppId() const;
// Suggested defaults
- static const char* const kAppId;
- static const char* const kOsPlatform;
- static const char* const kOsVersion;
- static const char* const kUpdateUrl;
- static const char* const kUpdateChannelKey;
- static const char* const kIsPowerwashAllowedKey;
+ static const char kAppId[];
+ static const char kOsPlatform[];
+ static const char kOsVersion[];
+ static const char kUpdateUrl[];
+ static const char kUpdateChannelKey[];
+ static const char kIsPowerwashAllowedKey[];
+ static const char kAutoUpdateServerKey[];
static const int64_t kDefaultMinUpdateChecks = 0;
static const int64_t kDefaultMaxUpdateChecks = 8;
@@ -212,6 +216,10 @@
virtual bool is_powerwash_allowed() const { return is_powerwash_allowed_; }
+ // Check if the provided update URL is official, meaning either the default
+ // autoupdate server or the autoupdate autotest server.
+ virtual bool IsUpdateUrlOfficial() const;
+
// For unit-tests.
void set_root(const std::string& root);
void set_current_channel(const std::string& channel) {