diff options
Diffstat (limited to 'remoting/host/installer/mac/Scripts')
-rwxr-xr-x | remoting/host/installer/mac/Scripts/keystone_install.sh | 7 | ||||
-rwxr-xr-x | remoting/host/installer/mac/Scripts/remoting_postflight.sh | 45 | ||||
-rwxr-xr-x | remoting/host/installer/mac/Scripts/uninstall.sh | 43 |
3 files changed, 95 insertions, 0 deletions
diff --git a/remoting/host/installer/mac/Scripts/keystone_install.sh b/remoting/host/installer/mac/Scripts/keystone_install.sh new file mode 100755 index 0000000..2ef3b4b --- /dev/null +++ b/remoting/host/installer/mac/Scripts/keystone_install.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +/usr/sbin/installer -pkg "$1/Chrome Remote Desktop.mpkg" -target / diff --git a/remoting/host/installer/mac/Scripts/remoting_postflight.sh b/remoting/host/installer/mac/Scripts/remoting_postflight.sh new file mode 100755 index 0000000..0b30ed2 --- /dev/null +++ b/remoting/host/installer/mac/Scripts/remoting_postflight.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +HELPERTOOLS=/Library/PrivilegedHelperTools +NAME=org.chromium.chromoting +AUTH_FILE="$HELPERTOOLS/$NAME.json" +PLIST=/Library/LaunchAgents/org.chromium.chromoting.plist + +KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin +KSUPDATE=https://tools.google.com/service/update2 +KSPID=com.google.chrome_remote_desktop +KSPVERSION=0.5 + +trap onexit ERR + +function onexit { + # Log an error but don't report an install failure if this script has errors. + logger An error occurred while launching the service + exit 0 +} + +# Update owner and permissions for auth file. +chown $USER "$AUTH_FILE" +chmod 600 "$AUTH_FILE" + +# Load the service. +# The launchctl command we'd like to run: +# launchctl load -w -S Aqua $PLIST +# However, since we're installing as an admin, the launchctl command is run +# as if it had a sudo prefix, which means it tries to load the service in +# system rather than user space. +# To launch the service in user space, we need to get the current user (using +# ps and grepping for the loginwindow.app) and run the launchctl cmd as that +# user (using launchctl bsexec). +set `ps aux | grep loginwindow.app | grep -v grep` +# At this point, $1=username and $2=userid +if [[ -n $1 && -n $2 ]]; then + launchctl bsexec "$2" sudo -u "$1" launchctl load -w -S Aqua $PLIST +fi + +# Register a ticket with Keystone so we're updated. +$KSADMIN --register --productid $KSPID --version $KSPVERSION --xcpath $PLIST --url $KSUPDATE diff --git a/remoting/host/installer/mac/Scripts/uninstall.sh b/remoting/host/installer/mac/Scripts/uninstall.sh new file mode 100755 index 0000000..b2bf00e --- /dev/null +++ b/remoting/host/installer/mac/Scripts/uninstall.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +# Copyright (c) 2012 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# TODO(garykac): Replace this with a proper double-clickable uninstaller app. +NAME=org.chromium.chromoting +LAUNCHAGENTS=/Library/LaunchAgents +HELPERTOOLS=/Library/PrivilegedHelperTools +PLIST="$LAUNCHAGENTS/$NAME.plist" + +# Stop service if currently running. +# TODO(garykac): Trap errors and replace sleep with a check for when the +# service is stopped. +launchctl stop $NAME +launchctl unload -w -S Aqua $PLIST +sleep 1 + +# Cleanup files from old versions of installer. +sudo rm -f "$LAUNCHAGENTS/com.google.chrome_remote_desktop.plist" +sudo rm -f "$HELPERTOOLS/remoting_me2me_host" +sudo rm -f "$HELPERTOOLS/me2me.sh" +sudo rm -f "$HELPERTOOLS/com.google.chrome_remote_desktop.me2me_host" +sudo rm -f "$HELPERTOOLS/com.google.chrome_remote_desktop.me2me.sh" +sudo rm -f ~/.ChromotingConfig.json +sudo rm -f "$HELPERTOOLS/auth.json" +sudo rm -f "$HELPERTOOLS/host.json" +sudo rm -f "$HELPERTOOLS/me2me_enabled" +sudo rm -f "$HELPERTOOLS/com.google.chrome_remote_desktop.me2me_enabled" +sudo rm -rf /ChromotingSetup + +# Cleanup installed files. +sudo rm -f $PLIST +sudo rm -f "$HELPERTOOLS/$NAME.me2me_host" +sudo rm -f "$HELPERTOOLS/$NAME.me2me.sh" +sudo rm -f "$HELPERTOOLS/$NAME.json" +sudo rm -f "$HELPERTOOLS/$NAME.me2me_enabled" + +# Unregister our ticket from Keystone. +KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin +KSPID=com.google.chrome_remote_desktop +$KSADMIN --delete --productid $KSPID |