OLD | NEW |
1 #!/bin/sh -e | 1 #!/bin/sh -e |
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. |
11 | 11 |
12 # Update /boot/extlinux.conf. | 12 # Update /boot/extlinux.conf. |
13 INSTALL_ROOT=`dirname "$0"` | 13 INSTALL_ROOT=`dirname "$0"` |
14 INSTALL_DEV="$1" | 14 INSTALL_DEV="$1" |
| 15 POSTCOMMIT="$2" |
15 | 16 |
16 # Only update extlinux.conf if $1 is non-empty | 17 if [ "$POSTCOMMIT" != "--postcommit" ]; then |
17 if [ -n "$INSTALL_DEV" ]; then | 18 # Pre-commit. Returning an error here will prevent ever booting into the |
18 # Set default label to chromeos-hd. | 19 # installed system. |
19 sed -i 's/^DEFAULT .*/DEFAULT chromeos-hd/' "$INSTALL_ROOT"/boot/extlinux.conf | 20 |
20 sed -i "{ s:HDROOT:$INSTALL_DEV: }" "$INSTALL_ROOT"/boot/extlinux.conf | 21 # If the mount-point is read-write, update the bootloader |
| 22 # Only update extlinux.conf if $1 is non-empty |
| 23 if [ -n "$INSTALL_DEV" ]; then |
| 24 # Set default label to chromeos-hd. |
| 25 sed -i 's/^DEFAULT .*/DEFAULT chromeos-hd/' \ |
| 26 "$INSTALL_ROOT"/boot/extlinux.conf || true |
| 27 sed -i "{ s:HDROOT:$INSTALL_DEV: }" \ |
| 28 "$INSTALL_ROOT"/boot/extlinux.conf || true |
| 29 fi |
| 30 |
| 31 else |
| 32 # Post-commit. At this point an unexpected reboot may boot the installed |
| 33 # system, but returning an error here will cause the updater to try to |
| 34 # not boot the installed system, instead keeping the existing system. |
| 35 |
21 fi | 36 fi |
22 | 37 |
| 38 |
OLD | NEW |