Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / remoting / tools / mac / chromoting-set-channel.sh
blobab1e37a9d66a1b4688152f8c51ca4f7e83631f21
1 #!/bin/sh
3 # Copyright (c) 2012 The Chromium 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.
7 set -e -u
9 ME="$(basename "$0")"
10 readonly ME
12 KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
13 KSPID=com.google.chrome_remote_desktop
15 usage() {
16 echo "Usage: ${ME} <channel>" >&2
17 echo "where <channel> is 'beta' or 'stable'" >&2
20 log() {
21 local message="$1"
22 echo "${message}"
23 logger "${message}"
26 checkroot() {
27 if [[ "$(id -u)" != "0" ]]; then
28 echo "This script requires root permissions" 1>&2
29 exit 1
33 main() {
34 local channel="$1"
36 if [[ "${channel}" != "beta" && "${channel}" != "stable" ]]; then
37 usage
38 exit 1
41 local channeltag="${channel}"
42 if [[ "${channel}" == "stable" ]]; then
43 channeltag=""
46 log "Switching Chrome Remote Desktop channel to ${channel}"
48 $KSADMIN --productid "$KSPID" --tag "${channeltag}"
50 if [[ "${channel}" == "stable" ]]; then
51 echo "You're not done yet!"
52 echo "You must now UNINSTALL and RE-INSTALL the latest version of Chrome"
53 echo "Remote Desktop to get your machine back on the stable channel."
54 echo "Thank you!"
55 else
56 echo "Switch to ${channel} channel complete."
57 echo "You will download ${channel} binaries during the next update check."
61 checkroot
63 if [[ $# < 1 ]]; then
64 usage
65 exit 1
68 main "$@"