Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/sh -ex | 1 #!/bin/sh -ex |
| 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 . "$(dirname "$0")/chromeos-common.sh" | 7 . "$(dirname "$0")/chromeos-common.sh" |
| 8 . "/opt/google/memento_updater/memento_updater_logging.sh" | 8 . "/opt/google/memento_updater/memento_updater_logging.sh" |
| 9 . "/opt/google/memento_updater/find_omaha.sh" | 9 . "/opt/google/memento_updater/find_omaha.sh" |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 | 67 |
| 68 log $(echo "${RESULT}" | grep -E "(failed|unavailable)") | 68 log $(echo "${RESULT}" | grep -E "(failed|unavailable)") |
| 69 log "Failed to set time" | 69 log "Failed to set time" |
| 70 return 1 | 70 return 1 |
| 71 } | 71 } |
| 72 | 72 |
| 73 log "Starting Factory Installer." | 73 log "Starting Factory Installer." |
| 74 | 74 |
| 75 log "Checking for Firmware Write Protect" | 75 log "Checking for Firmware Write Protect" |
| 76 | 76 |
| 77 # Only ChromeOS machines have this setting. | 77 # Only ChromeOS machines have meaninful output here. |
| 78 CHROME_SWITCHES=/sys/devices/platform/chromeos_acpi/CHSW | 78 if crossystem hwid >/dev/null; then |
| 79 if [ -e "${CHROME_SWITCHES}" ]; then | |
| 80 # Check for physical firmware write protect. We'll only | 79 # Check for physical firmware write protect. We'll only |
| 81 # clear this stuff if the case is open. | 80 # clear this stuff if the case is open. |
| 82 if [ $(( $(cat "${CHROME_SWITCHES}") & 512 )) = 512 ]; then | 81 if [ "$(crossystem wpsw_cur)" = "0" ; then |
|
Hung-Te
2011/02/18 03:44:07
Missing a "]"? (although it's not really necessary
| |
| 83 # Ensure that flash chips are in a known good state. | 82 # Ensure that flash chips are in a known good state. |
| 84 clear_fwwp | 83 clear_fwwp |
| 85 | 84 |
| 86 # Ensure that we can wipe TPM if necessary. | 85 # Ensure that we can wipe TPM if necessary. |
| 87 clear_tpm | 86 clear_tpm |
| 88 fi | 87 fi |
| 89 | |
| 90 # If this is an H2C BIOS, setup GPIO readout so we can use it | |
| 91 # in the next step. | |
| 92 mkdir -p /home/gpio | |
| 93 fi | 88 fi |
| 94 | 89 |
| 95 log "Pause to ensure ethernet connectivity" | 90 log "Waiting for ethernet connectivity to install" |
| 96 log "Or toggle developer mode to factory reset." | 91 log "Or disable developer mode to factory reset." |
| 97 while ! ifconfig eth0 | grep -q "inet addr"; do | 92 while ! ifconfig eth0 | grep -q "inet addr"; do |
| 98 # If developer switch is flipped, go to "reset mode" instead of | 93 # If developer switch is flipped, go to "reset mode" instead of |
| 99 # network install mode. Make sure gpio can be read (gpio_setup may | 94 # network install mode. Make sure gpio can be read (gpio_setup may |
| 100 # fail if the device is not ready). TODO(nsanders): fix developer | 95 # fail if the device is not ready). |
| 101 # switch detection when interface is standardized. | 96 if [ "$(crossystem devsw_cur)" = "0" ]; then |
| 102 # See https://code.google.com/p/chrome-os-partner/issues/detail?id=1940 | |
| 103 if [ -e /home/gpio ] && | |
| 104 /usr/sbin/gpio_setup && | |
| 105 [ "$(cat /home/gpio/developer_switch)" = "0" ]; then | |
| 106 log "Performing factory reset" | 97 log "Performing factory reset" |
| 107 if ! /usr/sbin/factory_reset.sh; then | 98 if ! /usr/sbin/factory_reset.sh; then |
| 108 log "Factory reset failed." | 99 log "Factory reset failed." |
| 109 exit 1 | 100 exit 1 |
| 110 fi | 101 fi |
| 111 | 102 |
| 112 log "Done" | 103 log "Done" |
| 113 exit 0 | 104 exit 0 |
| 114 fi | 105 fi |
| 115 sleep 1 | 106 sleep 1 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 dd if=/dev/zero of=${DST_DRIVE}$((${DST_RELEASE_PART} - 1)) | 219 dd if=/dev/zero of=${DST_DRIVE}$((${DST_RELEASE_PART} - 1)) |
| 229 dd if=/dev/zero of=${DST_DRIVE}$((${DST_FACTORY_PART} - 1)) | 220 dd if=/dev/zero of=${DST_DRIVE}$((${DST_FACTORY_PART} - 1)) |
| 230 exit 1 | 221 exit 1 |
| 231 fi | 222 fi |
| 232 | 223 |
| 233 log "All done installing." | 224 log "All done installing." |
| 234 | 225 |
| 235 sleep 3 | 226 sleep 3 |
| 236 shutdown -r now | 227 shutdown -r now |
| 237 sleep 1d # sleep indefinitely to avoid respawning rather than shutting down | 228 sleep 1d # sleep indefinitely to avoid respawning rather than shutting down |
| OLD | NEW |