OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 # This script is called after an AutoUpdate or USB install. The first argument | 7 # This script is called after an AutoUpdate or USB install. The first argument |
8 # is the partition where the new rootfs is installed or empty. If non-empty | 8 # is the partition where the new rootfs is installed or empty. If non-empty |
9 # the rootfs should be updated w/ the new bootloader config. If empty, the | 9 # the rootfs should be updated w/ the new bootloader config. If empty, the |
10 # rootfs is mounted-read only and should not be updated. | 10 # rootfs is mounted-read only and should not be updated. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 LEGACY_PART_NUM=12 | 65 LEGACY_PART_NUM=12 |
66 | 66 |
67 if [ "${FLAGS_postcommit}" -eq "${FLAGS_FALSE}" ]; then | 67 if [ "${FLAGS_postcommit}" -eq "${FLAGS_FALSE}" ]; then |
68 # Pre-commit. Returning an error here will prevent ever booting into the | 68 # Pre-commit. Returning an error here will prevent ever booting into the |
69 # installed system. | 69 # installed system. |
70 | 70 |
71 echo "Postinst running" | 71 echo "Postinst running" |
72 | 72 |
73 # If this FS was mounted read-write, we can't do deltas from it. Mark the | 73 # If this FS was mounted read-write, we can't do deltas from it. Mark the |
74 # FS as such | 74 # FS as such |
75 touch "${INSTALL_ROOT}/.nodelta" || true | 75 touch "${INSTALL_ROOT}/.nodelta" || true 2>&1 > /dev/null |
76 | 76 |
77 # TODO(zelidrag): http://crosbug/6367 - Remove this before the product is | 77 # TODO(zelidrag): http://crosbug/6367 - Remove this before the product is |
78 # released. For now, this should recover users that reimaged their machine. | 78 # released. For now, this should recover users that reimaged their machine. |
79 if [ -f /home/chronos/.oobe_completed ]; then | 79 if [ -f /home/chronos/.oobe_completed ]; then |
80 CONSENT_FILE="/home/chronos/Consent To Send Stats" | 80 CONSENT_FILE="/home/chronos/Consent To Send Stats" |
81 if [ ! -f "$CONSENT_FILE" ]; then | 81 if [ ! -f "$CONSENT_FILE" ]; then |
82 "${INSTALL_ROOT}/usr/bin/uuidgen" > "$CONSENT_FILE" | 82 "${INSTALL_ROOT}/usr/bin/uuidgen" > "$CONSENT_FILE" |
83 fi | 83 fi |
84 fi | 84 fi |
85 | 85 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 cgpt boot -i $LEGACY_PART_NUM ${ROOT_DEV} 2>&1 | 270 cgpt boot -i $LEGACY_PART_NUM ${ROOT_DEV} 2>&1 |
271 else | 271 else |
272 # The old gpt tool requires a -b arg to specify the PMBR bootcode. | 272 # The old gpt tool requires a -b arg to specify the PMBR bootcode. |
273 # We don't want to change the code, so we have to extract it, | 273 # We don't want to change the code, so we have to extract it, |
274 # then put it back. | 274 # then put it back. |
275 dd if=${ROOT_DEV} bs=512 count=1 of=/tmp/oldpmbr.bin | 275 dd if=${ROOT_DEV} bs=512 count=1 of=/tmp/oldpmbr.bin |
276 echo "marking part $LEGACY_PART_NUM bootable (old)" | 276 echo "marking part $LEGACY_PART_NUM bootable (old)" |
277 gpt -S boot -i $LEGACY_PART_NUM -b /tmp/oldpmbr.bin ${ROOT_DEV} 2>&1 | 277 gpt -S boot -i $LEGACY_PART_NUM -b /tmp/oldpmbr.bin ${ROOT_DEV} 2>&1 |
278 fi | 278 fi |
279 | 279 |
| 280 # At this point in the script, the new partition has been marked bootable |
| 281 # and a reboot will boot into it. Thus, it's important that any future |
| 282 # errors in this script do not cause this script to return failure. |
| 283 set +e |
| 284 |
280 # See if we need to update firmware. NOTE: we must activate new firmware | 285 # See if we need to update firmware. NOTE: we must activate new firmware |
281 # only after new kernel is actived (installed and made bootable), | 286 # only after new kernel is actived (installed and made bootable), |
282 # otherwise new firmware with all old kernels may lead to recovery screen | 287 # otherwise new firmware with all old kernels may lead to recovery screen |
283 # (due to new key). | 288 # (due to new key). |
284 FIRMWARE_UPDATE_SCRIPT="${INSTALL_ROOT}/usr/sbin/chromeos-firmwareupdate" | 289 FIRMWARE_UPDATE_SCRIPT="${INSTALL_ROOT}/usr/sbin/chromeos-firmwareupdate" |
285 if [ ${FLAGS_update_firmware} -eq "${FLAGS_TRUE}" -a \ | 290 if [ ${FLAGS_update_firmware} -eq "${FLAGS_TRUE}" -a \ |
286 -x "${FIRMWARE_UPDATE_SCRIPT}" ]; then | 291 -x "${FIRMWARE_UPDATE_SCRIPT}" ]; then |
287 FIRMWARE_UPDATE_MODE="" | 292 FIRMWARE_UPDATE_MODE="" |
288 if [ -n "${IS_FACTORY_INSTALL}" ]; then | 293 if [ -n "${IS_FACTORY_INSTALL}" ]; then |
289 # factory-mode | 294 # factory-mode |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 echo "marking part $LEGACY_PART_NUM bootable (new)" | 342 echo "marking part $LEGACY_PART_NUM bootable (new)" |
338 "${INSTALL_ROOT}"/usr/bin/cgpt boot -i $LEGACY_PART_NUM ${ROOT_DEV} 2>&1 | 343 "${INSTALL_ROOT}"/usr/bin/cgpt boot -i $LEGACY_PART_NUM ${ROOT_DEV} 2>&1 |
339 else | 344 else |
340 # The old gpt tool requires a -b arg to specify the PMBR bootcode. We don't | 345 # The old gpt tool requires a -b arg to specify the PMBR bootcode. We don't |
341 # want to change the code, so we have to extract it, then put it back. | 346 # want to change the code, so we have to extract it, then put it back. |
342 dd if=${ROOT_DEV} bs=512 count=1 of=/tmp/oldpmbr.bin | 347 dd if=${ROOT_DEV} bs=512 count=1 of=/tmp/oldpmbr.bin |
343 echo "marking part $LEGACY_PART_NUM bootable (old)" | 348 echo "marking part $LEGACY_PART_NUM bootable (old)" |
344 gpt -S boot -i $LEGACY_PART_NUM -b /tmp/oldpmbr.bin ${ROOT_DEV} 2>&1 | 349 gpt -S boot -i $LEGACY_PART_NUM -b /tmp/oldpmbr.bin ${ROOT_DEV} 2>&1 |
345 fi | 350 fi |
346 fi | 351 fi |
OLD | NEW |