OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 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/omaha_request_params.h" | 5 #include "update_engine/omaha_request_params.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <sys/utsname.h> | 9 #include <sys/utsname.h> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 TEST_AND_RETURN_FALSE(GetMachineId(&machine_id)); | 31 TEST_AND_RETURN_FALSE(GetMachineId(&machine_id)); |
32 user_id = machine_id; | 32 user_id = machine_id; |
33 os_platform = OmahaRequestParams::kOsPlatform; | 33 os_platform = OmahaRequestParams::kOsPlatform; |
34 os_version = OmahaRequestParams::kOsVersion; | 34 os_version = OmahaRequestParams::kOsVersion; |
35 app_version = GetLsbValue("CHROMEOS_RELEASE_VERSION", ""); | 35 app_version = GetLsbValue("CHROMEOS_RELEASE_VERSION", ""); |
36 os_sp = app_version + "_" + GetMachineType(); | 36 os_sp = app_version + "_" + GetMachineType(); |
37 os_board = GetLsbValue("CHROMEOS_RELEASE_BOARD", ""); | 37 os_board = GetLsbValue("CHROMEOS_RELEASE_BOARD", ""); |
38 app_id = OmahaRequestParams::kAppId; | 38 app_id = OmahaRequestParams::kAppId; |
39 app_lang = "en-US"; | 39 app_lang = "en-US"; |
40 app_track = GetLsbValue("CHROMEOS_RELEASE_TRACK", ""); | 40 app_track = GetLsbValue("CHROMEOS_RELEASE_TRACK", ""); |
| 41 struct stat stbuf; |
| 42 |
| 43 // Deltas are only okay if the /.nodelta file does not exist. |
| 44 // If we don't know (i.e. stat() returns some unexpected error), |
| 45 // then err on the side of caution and say deltas are not okay |
| 46 delta_okay = (stat((root_ + "/.nodelta").c_str(), &stbuf) < 0) && |
| 47 (errno == ENOENT); |
| 48 |
41 update_url = GetLsbValue("CHROMEOS_AUSERVER", | 49 update_url = GetLsbValue("CHROMEOS_AUSERVER", |
42 OmahaRequestParams::kUpdateUrl); | 50 OmahaRequestParams::kUpdateUrl); |
43 return true; | 51 return true; |
44 } | 52 } |
45 | 53 |
46 namespace { | 54 namespace { |
47 const size_t kGuidDataByteLength = 128 / 8; | 55 const size_t kGuidDataByteLength = 128 / 8; |
48 const string::size_type kGuidStringLength = 38; | 56 const string::size_type kGuidStringLength = 38; |
49 // Formats 16 bytes (128 bits) of data as a GUID: | 57 // Formats 16 bytes (128 bits) of data as a GUID: |
50 // "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" where X is a hex digit | 58 // "{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}" where X is a hex digit |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 114 |
107 string OmahaRequestDeviceParams::GetMachineType() const { | 115 string OmahaRequestDeviceParams::GetMachineType() const { |
108 struct utsname buf; | 116 struct utsname buf; |
109 string ret; | 117 string ret; |
110 if (uname(&buf) == 0) | 118 if (uname(&buf) == 0) |
111 ret = buf.machine; | 119 ret = buf.machine; |
112 return ret; | 120 return ret; |
113 } | 121 } |
114 | 122 |
115 } // namespace chromeos_update_engine | 123 } // namespace chromeos_update_engine |
OLD | NEW |