| 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 fi | 61 fi |
| 62 # This could just be an unrelated process, but it's ok to be conservative. | 62 # This could just be an unrelated process, but it's ok to be conservative. |
| 63 lecho "Already running. Exiting now." | 63 lecho "Already running. Exiting now." |
| 64 exit 1 | 64 exit 1 |
| 65 } | 65 } |
| 66 | 66 |
| 67 get_version() { | 67 get_version() { |
| 68 grep ^CHROMEOS_RELEASE_VERSION /etc/lsb-release | cut -d = -f 2- | 68 grep ^CHROMEOS_RELEASE_VERSION /etc/lsb-release | cut -d = -f 2- |
| 69 } | 69 } |
| 70 | 70 |
| 71 is_official() { |
| 72 grep ^CHROMEOS_RELEASE_DESCRIPTION /etc/lsb-release | cut -d = -f 2- | \ |
| 73 grep Official |
| 74 } |
| 75 |
| 71 # Generate a uniform random number in 0..max-1. | 76 # Generate a uniform random number in 0..max-1. |
| 72 generate_uniform_random() { | 77 generate_uniform_random() { |
| 73 local max=$1 | 78 local max=$1 |
| 74 local random="$(od -An -N4 -tu /dev/urandom)" | 79 local random="$(od -An -N4 -tu /dev/urandom)" |
| 75 echo $((random % max)) | 80 echo $((random % max)) |
| 76 } | 81 } |
| 77 | 82 |
| 78 is_feedback_disabled() { | 83 is_feedback_disabled() { |
| 79 # See crosbug.com/3303. | 84 # See crosbug.com/3303. |
| 80 return 1 | 85 return 1 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 99 "max ${MAX_CRASH_RATE}send/24hrs" | 104 "max ${MAX_CRASH_RATE}send/24hrs" |
| 100 return 1 | 105 return 1 |
| 101 fi | 106 fi |
| 102 mktemp "${TIMESTAMPS_DIR}"/XXXX > /dev/null | 107 mktemp "${TIMESTAMPS_DIR}"/XXXX > /dev/null |
| 103 return 0 | 108 return 0 |
| 104 } | 109 } |
| 105 | 110 |
| 106 send_crash() { | 111 send_crash() { |
| 107 local sleep_time=$(generate_uniform_random $SECONDS_SEND_SPREAD) | 112 local sleep_time=$(generate_uniform_random $SECONDS_SEND_SPREAD) |
| 108 local url="${MINIDUMP_UPLOAD_STAGING_URL}" | 113 local url="${MINIDUMP_UPLOAD_STAGING_URL}" |
| 114 if is_official; then |
| 115 url="${MINIDUMP_UPLOAD_PROD_URL}" |
| 116 fi |
| 109 lecho "Sending crash:" | 117 lecho "Sending crash:" |
| 110 lecho " Scheduled to send in ${sleep_time}s" | 118 lecho " Scheduled to send in ${sleep_time}s" |
| 111 lecho " Minidump: ${minidump_path}" | 119 lecho " Minidump: ${minidump_path}" |
| 112 lecho " URL: ${url}" | 120 lecho " URL: ${url}" |
| 113 lecho " Product: ${CHROMEOS_PRODUCT}" | 121 lecho " Product: ${CHROMEOS_PRODUCT}" |
| 114 lecho " Version: ${chromeos_version}" | 122 lecho " Version: ${chromeos_version}" |
| 115 if [ -s "${minidump_path}" ]; then | 123 if [ -s "${minidump_path}" ]; then |
| 116 # We cannot tell much from the minidump without symbols, but we can tell | 124 # We cannot tell much from the minidump without symbols, but we can tell |
| 117 # at least what modules were loaded at the time of crash | 125 # at least what modules were loaded at the time of crash |
| 118 local modules="$(/usr/bin/minidump_dump "${minidump_path}" 2>&- | \ | 126 local modules="$(/usr/bin/minidump_dump "${minidump_path}" 2>&- | \ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 # Send system-wide crashes | 197 # Send system-wide crashes |
| 190 send_crashes "/var/spool/crash" | 198 send_crashes "/var/spool/crash" |
| 191 | 199 |
| 192 # Send user-specific crashes | 200 # Send user-specific crashes |
| 193 send_crashes "/home/chronos/user/crash" | 201 send_crashes "/home/chronos/user/crash" |
| 194 | 202 |
| 195 lecho "Done" | 203 lecho "Done" |
| 196 } | 204 } |
| 197 | 205 |
| 198 main | 206 main |
| OLD | NEW |