Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1899)

Unified Diff: scripts/image_signing/set_channel.sh

Issue 6813047: Add a script to arbitrarily change channels on image (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: usage Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/image_signing/set_channel.sh
diff --git a/scripts/image_signing/set_channel.sh b/scripts/image_signing/set_channel.sh
new file mode 100755
index 0000000000000000000000000000000000000000..064d737f1ea8a4b4f393c051086b8a4032ff3520
--- /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 "$@"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698