OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 set -e | 7 set -e |
8 | 8 |
9 # Product ID in crash report | 9 # Product ID in crash report |
10 CHROMEOS_PRODUCT=ChromeOS | 10 CHROMEOS_PRODUCT=ChromeOS |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 # hours. | 61 # hours. |
62 TIMESTAMPS_DIR="/var/lib/crash_sender" | 62 TIMESTAMPS_DIR="/var/lib/crash_sender" |
63 | 63 |
64 # Path to a directory of restricted certificates which includes | 64 # Path to a directory of restricted certificates which includes |
65 # a certificate for ${REPORT_UPLOAD_PROD_URL}. | 65 # a certificate for ${REPORT_UPLOAD_PROD_URL}. |
66 RESTRICTED_CERTIFICATES_PATH="/usr/share/chromeos-ca-certificates" | 66 RESTRICTED_CERTIFICATES_PATH="/usr/share/chromeos-ca-certificates" |
67 | 67 |
68 # Temp directory for this process. | 68 # Temp directory for this process. |
69 TMP_DIR="" | 69 TMP_DIR="" |
70 | 70 |
| 71 # Path to list_proxies. |
| 72 LIST_PROXIES="/usr/bin/list_proxies" |
| 73 |
71 lecho() { | 74 lecho() { |
72 logger -t "${TAG}" "$@" | 75 logger -t "${TAG}" "$@" |
73 } | 76 } |
74 | 77 |
75 # Returns true if mock is enabled. | 78 # Returns true if mock is enabled. |
76 is_mock() { | 79 is_mock() { |
77 [ -f "${MOCK_CRASH_SENDING}" ] && return 0 | 80 [ -f "${MOCK_CRASH_SENDING}" ] && return 0 |
78 return 1 | 81 return 1 |
79 } | 82 } |
80 | 83 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 lecho "Mocking unsuccessful send" | 254 lecho "Mocking unsuccessful send" |
252 return 1 | 255 return 1 |
253 fi | 256 fi |
254 fi | 257 fi |
255 | 258 |
256 if ! sleep ${sleep_time}; then | 259 if ! sleep ${sleep_time}; then |
257 lecho "Sleep failed" | 260 lecho "Sleep failed" |
258 return 1 | 261 return 1 |
259 fi | 262 fi |
260 | 263 |
| 264 # Read in the first proxy, if any, for a given URL. NOTE: The |
| 265 # double-quotes are necessary due to a bug in dash with the "local" |
| 266 # builtin command and values that have spaces in them (see |
| 267 # "https://bugs.launchpad.net/ubuntu/+source/dash/+bug/139097"). |
| 268 local proxy="`${LIST_PROXIES} -quiet "${url}" | head -1`" |
| 269 # if a direct connection should be used, unset the proxy variable. |
| 270 [ "${proxy}" = "direct://" ] && proxy= |
261 local report_id="${TMP_DIR}/report_id" | 271 local report_id="${TMP_DIR}/report_id" |
262 local curl_stderr="${TMP_DIR}/curl_stderr" | 272 local curl_stderr="${TMP_DIR}/curl_stderr" |
263 | 273 |
264 set +e | 274 set +e |
265 curl "${url}" \ | 275 curl "${url}" ${proxy:+--proxy "$proxy"} \ |
266 --capath "${RESTRICTED_CERTIFICATES_PATH}" --ciphers HIGH \ | 276 --capath "${RESTRICTED_CERTIFICATES_PATH}" --ciphers HIGH \ |
267 -F "prod=${CHROMEOS_PRODUCT}" \ | 277 -F "prod=${CHROMEOS_PRODUCT}" \ |
268 -F "ver=${chromeos_version}" \ | 278 -F "ver=${chromeos_version}" \ |
269 -F "upload_file_${kind}=@${report_payload}" \ | 279 -F "upload_file_${kind}=@${report_payload}" \ |
270 -F "board=${board}" \ | 280 -F "board=${board}" \ |
271 -F "hwclass=${hwclass}" \ | 281 -F "hwclass=${hwclass}" \ |
272 -F "exec_name=${exec_name}" \ | 282 -F "exec_name=${exec_name}" \ |
273 -F "${extra_key1}=${extra_value1}" \ | 283 -F "${extra_key1}=${extra_value1}" \ |
274 -F "${extra_key2}=${extra_value2}" \ | 284 -F "${extra_key2}=${extra_value2}" \ |
275 -F "guid=<${CONSENT_ID}" -o "${report_id}" 2>"${curl_stderr}" | 285 -F "guid=<${CONSENT_ID}" -o "${report_id}" 2>"${curl_stderr}" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 TMP_DIR="$(mktemp -d /tmp/crash_sender.XXXX)" | 413 TMP_DIR="$(mktemp -d /tmp/crash_sender.XXXX)" |
404 | 414 |
405 # Send system-wide crashes | 415 # Send system-wide crashes |
406 send_crashes "/var/spool/crash" | 416 send_crashes "/var/spool/crash" |
407 | 417 |
408 # Send user-specific crashes | 418 # Send user-specific crashes |
409 send_crashes "/home/chronos/user/crash" | 419 send_crashes "/home/chronos/user/crash" |
410 } | 420 } |
411 | 421 |
412 main | 422 main |
OLD | NEW |