| 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 10 matching lines...) Expand all Loading... |
| 21 # Path to find which is required for computing the crash rate. | 21 # Path to find which is required for computing the crash rate. |
| 22 FIND="/usr/bin/find" | 22 FIND="/usr/bin/find" |
| 23 | 23 |
| 24 # Set this to 1 in the environment to allow uploading crash reports | 24 # Set this to 1 in the environment to allow uploading crash reports |
| 25 # for unofficial versions. | 25 # for unofficial versions. |
| 26 FORCE_OFFICIAL=${FORCE_OFFICIAL:-0} | 26 FORCE_OFFICIAL=${FORCE_OFFICIAL:-0} |
| 27 | 27 |
| 28 # Path to hardware class description. | 28 # Path to hardware class description. |
| 29 HWCLASS_PATH="/sys/devices/platform/chromeos_acpi/HWID" | 29 HWCLASS_PATH="/sys/devices/platform/chromeos_acpi/HWID" |
| 30 | 30 |
| 31 # Ignore PAUSE_CRASH_SENDING file if set. |
| 32 OVERRIDE_PAUSE_SENDING=${OVERRIDE_PAUSE_SENDING:-0} |
| 33 |
| 31 # Maximum crashes to send per day. | 34 # Maximum crashes to send per day. |
| 32 MAX_CRASH_RATE=${MAX_CRASH_RATE:-32} | 35 MAX_CRASH_RATE=${MAX_CRASH_RATE:-32} |
| 33 | 36 |
| 34 # Path to metrics_client. | 37 # Path to metrics_client. |
| 35 METRICS_CLIENT="/usr/bin/metrics_client" | 38 METRICS_CLIENT="/usr/bin/metrics_client" |
| 36 | 39 |
| 37 # File whose existence mocks crash sending. If empty we pretend the | 40 # File whose existence mocks crash sending. If empty we pretend the |
| 38 # crash sending was successful, otherwise unsuccessful. | 41 # crash sending was successful, otherwise unsuccessful. |
| 39 MOCK_CRASH_SENDING="/tmp/mock-crash-sending" | 42 MOCK_CRASH_SENDING="/tmp/mock-crash-sending" |
| 40 | 43 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 fi | 339 fi |
| 337 | 340 |
| 338 # Send was successful, now remove. | 341 # Send was successful, now remove. |
| 339 lecho "Successfully sent crash ${meta_path} and removing." | 342 lecho "Successfully sent crash ${meta_path} and removing." |
| 340 remove_report "${meta_path}" | 343 remove_report "${meta_path}" |
| 341 done | 344 done |
| 342 } | 345 } |
| 343 | 346 |
| 344 main() { | 347 main() { |
| 345 trap cleanup EXIT INT TERM | 348 trap cleanup EXIT INT TERM |
| 346 if [ -e "${PAUSE_CRASH_SENDING}" ]; then | 349 if [ -e "${PAUSE_CRASH_SENDING}" ] && \ |
| 350 [ ${OVERRIDE_PAUSE_SENDING} -eq 0 ]; then |
| 347 lecho "Exiting early due to ${PAUSE_CRASH_SENDING}." | 351 lecho "Exiting early due to ${PAUSE_CRASH_SENDING}." |
| 348 exit 1 | 352 exit 1 |
| 349 fi | 353 fi |
| 350 | 354 |
| 351 check_not_already_running | 355 check_not_already_running |
| 352 | 356 |
| 353 for dependency in "${FIND}" "${METRICS_CLIENT}"; do | 357 for dependency in "${FIND}" "${METRICS_CLIENT}"; do |
| 354 if [ ! -x "${dependency}" ]; then | 358 if [ ! -x "${dependency}" ]; then |
| 355 lecho "Fatal: Crash sending disabled: ${dependency} not found." | 359 lecho "Fatal: Crash sending disabled: ${dependency} not found." |
| 356 exit 1 | 360 exit 1 |
| 357 fi | 361 fi |
| 358 done | 362 done |
| 359 | 363 |
| 360 TMP_DIR="$(mktemp -d /tmp/crash_sender.XXXX)" | 364 TMP_DIR="$(mktemp -d /tmp/crash_sender.XXXX)" |
| 361 | 365 |
| 362 # Send system-wide crashes | 366 # Send system-wide crashes |
| 363 send_crashes "/var/spool/crash" | 367 send_crashes "/var/spool/crash" |
| 364 | 368 |
| 365 # Send user-specific crashes | 369 # Send user-specific crashes |
| 366 send_crashes "/home/chronos/user/crash" | 370 send_crashes "/home/chronos/user/crash" |
| 367 } | 371 } |
| 368 | 372 |
| 369 main | 373 main |
| OLD | NEW |