summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaurav Shah <gauravsh@chromium.org>2011-04-08 14:55:30 -0700
committerGaurav Shah <gauravsh@chromium.org>2011-04-08 14:55:30 -0700
commit6e567a10e29fb4e23d394388064a6304072b6daa (patch)
treec618ab12f0663a4536bf6cfa8829162601b2c456
parent55af5b539a50b1faea736487f8fb51047d9f41e9 (diff)
downloadvboot-6e567a10e29fb4e23d394388064a6304072b6daa.tar.gz
Add a script to arbitrarily change channels on image
Change-Id: Icf9abbff05f9b29664216079b5c008cb7906a4f6 BUG=chrome-os-partner:3229 TEST=manually on an image. Review URL: http://codereview.chromium.org/6813047
-rwxr-xr-xscripts/image_signing/set_channel.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/image_signing/set_channel.sh b/scripts/image_signing/set_channel.sh
new file mode 100755
index 00000000..064d737f
--- /dev/null
+++ b/scripts/image_signing/set_channel.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Changes the channel on a Chrome OS image.
+
+# Load common constants and variables.
+. "$(dirname "$0")/common.sh"
+
+set -e
+
+if [ $# -ne 2 ]; then
+ cat <<EOF
+Usage: $PROG <image.bin> <channel>
+
+<image.bin>: Path to image.
+<channel>: The new channel of the image.
+EOF
+ exit 1
+fi
+
+main() {
+ local image=$1
+ local to=$2
+
+ rootfs=$(make_temp_dir)
+ mount_image_partition "${image}" 3 "${rootfs}"
+ # Get the current channel on the image.
+ local from=$(grep '^CHROMEOS_RELEASE_TRACK=' \
+ "${rootfs}/etc/lsb-release" | cut -d '=' -f 2)
+ from=${from%"-channel"}
+ echo "Current channel is '${from}'. Changing to '${to}'."
+ sed -i "s/\b${from}\b/${to}/" "${rootfs}/etc/lsb-release" &&
+ echo "Channel change successful."
+ cat "${rootfs}/etc/lsb-release"
+}
+
+main "$@"