Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Side by Side Diff: utils.cc

Issue 3965001: AU: Restrict URL/version change over D-Bus to non-official builds only. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "update_engine/utils.h" 5 #include "update_engine/utils.h"
6 6
7 #include <sys/mount.h> 7 #include <sys/mount.h>
8 #include <sys/resource.h> 8 #include <sys/resource.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 21 matching lines...) Expand all
32 32
33 using std::min; 33 using std::min;
34 using std::string; 34 using std::string;
35 using std::vector; 35 using std::vector;
36 36
37 namespace chromeos_update_engine { 37 namespace chromeos_update_engine {
38 38
39 namespace utils { 39 namespace utils {
40 40
41 static const char kOOBECompletedMarker[] = "/home/chronos/.oobe_completed"; 41 static const char kOOBECompletedMarker[] = "/home/chronos/.oobe_completed";
42 static const char kDevImageMarker[] = "/root/.dev_mode";
42 43
43 bool IsOfficialBuild() { 44 bool IsOfficialBuild() {
44 OmahaRequestDeviceParams params; 45 return !file_util::PathExists(FilePath(kDevImageMarker));
45 if (!params.Init("", "")) {
46 return true;
47 }
48 return params.app_track != "buildbot-build" &&
49 params.app_track != "developer-build";
50 } 46 }
51 47
52 bool IsOOBEComplete() { 48 bool IsOOBEComplete() {
53 return file_util::PathExists(FilePath(kOOBECompletedMarker)); 49 return file_util::PathExists(FilePath(kOOBECompletedMarker));
54 } 50 }
55 51
56 bool WriteFile(const char* path, const char* data, int data_len) { 52 bool WriteFile(const char* path, const char* data, int data_len) {
57 DirectFileWriter writer; 53 DirectFileWriter writer;
58 TEST_AND_RETURN_FALSE_ERRNO(0 == writer.Open(path, 54 TEST_AND_RETURN_FALSE_ERRNO(0 == writer.Open(path,
59 O_WRONLY | O_CREAT | O_TRUNC, 55 O_WRONLY | O_CREAT | O_TRUNC,
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 int min = value - range / 2; 512 int min = value - range / 2;
517 int max = value + range - range / 2; 513 int max = value + range - range / 2;
518 return base::RandInt(min, max); 514 return base::RandInt(min, max);
519 } 515 }
520 516
521 const char* const kStatefulPartition = "/mnt/stateful_partition"; 517 const char* const kStatefulPartition = "/mnt/stateful_partition";
522 518
523 } // namespace utils 519 } // namespace utils
524 520
525 } // namespace chromeos_update_engine 521 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698