| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009-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 # Script to update the kernel on a live running ChromiumOS instance. | 7 # Script to update the kernel on a live running ChromiumOS instance. |
| 8 | 8 |
| 9 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
| 10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 function learn_device() { | 55 function learn_device() { |
| 56 [ -n "${FLAGS_device}" ] && return | 56 [ -n "${FLAGS_device}" ] && return |
| 57 remote_sh df /mnt/stateful_partition | 57 remote_sh df /mnt/stateful_partition |
| 58 FLAGS_device=$(echo "${REMOTE_OUT}" | awk '/dev/ {print $1}' | sed s/1\$//) | 58 FLAGS_device=$(echo "${REMOTE_OUT}" | awk '/dev/ {print $1}' | sed s/1\$//) |
| 59 info "Target reports root device is ${FLAGS_device}" | 59 info "Target reports root device is ${FLAGS_device}" |
| 60 } | 60 } |
| 61 | 61 |
| 62 # Ask the target what the kernel partition is | 62 # Ask the target what the kernel partition is |
| 63 function learn_partition() { | 63 function learn_partition() { |
| 64 [ -n "${FLAGS_partition}" ] && return | 64 [ -n "${FLAGS_partition}" ] && return |
| 65 remote_sh cat /proc/cmdline | 65 ! remote_sh rootdev |
| 66 if echo "${REMOTE_OUT}" | egrep -q "${FLAGS_device}3"; then | 66 if [ "${REMOTE_OUT}" == "/dev/dm-0" ]; then |
| 67 remote_sh ls /sys/block/dm-0/slaves |
| 68 REMOTE_OUT="/dev/${REMOTE_OUT}" |
| 69 fi |
| 70 if [ "${REMOTE_OUT}" == "${FLAGS_device}3" ]; then |
| 67 FLAGS_partition="${FLAGS_device}2" | 71 FLAGS_partition="${FLAGS_device}2" |
| 68 else | 72 else |
| 69 FLAGS_partition="${FLAGS_device}4" | 73 FLAGS_partition="${FLAGS_device}4" |
| 70 fi | 74 fi |
| 71 if [ -z "${FLAGS_partition}" ]; then | 75 if [ -z "${FLAGS_partition}" ]; then |
| 72 error "Partition required" | 76 error "Partition required" |
| 73 exit 1 | 77 exit 1 |
| 74 fi | 78 fi |
| 75 info "Target reports kernel partition is ${FLAGS_partition}" | 79 info "Target reports kernel partition is ${FLAGS_partition}" |
| 76 } | 80 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 fi | 142 fi |
| 139 | 143 |
| 140 remote_reboot | 144 remote_reboot |
| 141 | 145 |
| 142 remote_sh uname -r -v | 146 remote_sh uname -r -v |
| 143 info "old kernel: ${old_kernel}" | 147 info "old kernel: ${old_kernel}" |
| 144 info "new kernel: ${REMOTE_OUT}" | 148 info "new kernel: ${REMOTE_OUT}" |
| 145 } | 149 } |
| 146 | 150 |
| 147 main "$@" | 151 main "$@" |
| OLD | NEW |