OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Changes the channel on a Chrome OS image. |
| 8 |
| 9 # Load common constants and variables. |
| 10 . "$(dirname "$0")/common.sh" |
| 11 |
| 12 set -e |
| 13 |
| 14 if [ $# -ne 2 ]; then |
| 15 cat <<EOF |
| 16 Usage: $PROG <image.bin> <channel> |
| 17 |
| 18 <image.bin>: Path to image. |
| 19 <channel>: The new channel of the image. |
| 20 EOF |
| 21 exit 1 |
| 22 fi |
| 23 |
| 24 main() { |
| 25 local image=$1 |
| 26 local to=$2 |
| 27 |
| 28 rootfs=$(make_temp_dir) |
| 29 mount_image_partition "${image}" 3 "${rootfs}" |
| 30 # Get the current channel on the image. |
| 31 local from=$(grep '^CHROMEOS_RELEASE_TRACK=' \ |
| 32 "${rootfs}/etc/lsb-release" | cut -d '=' -f 2) |
| 33 from=${from%"-channel"} |
| 34 echo "Current channel is '${from}'. Changing to '${to}'." |
| 35 sed -i "s/\b${from}\b/${to}/" "${rootfs}/etc/lsb-release" && |
| 36 echo "Channel change successful." |
| 37 cat "${rootfs}/etc/lsb-release" |
| 38 } |
| 39 |
| 40 main "$@" |
OLD | NEW |