summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorgarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 23:14:36 +0000
committergarykac@chromium.org <garykac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-18 23:14:36 +0000
commit38c3cc069e778d028262f6eed1fc6edaede70837 (patch)
treece9f680c852b4047b654e6f9e47e17d27cbd2842 /remoting
parent2d4ce826e362a773d3f08ef004237c7b5cc8a8f4 (diff)
downloadchromium_src-38c3cc069e778d028262f6eed1fc6edaede70837.zip
chromium_src-38c3cc069e778d028262f6eed1fc6edaede70837.tar.gz
chromium_src-38c3cc069e778d028262f6eed1fc6edaede70837.tar.bz2
[Chromoting] Update installer pre/post scripts to handle already running hosts.
This stops the host if it is already running and restarts it after the installation is complete. BUG=123650 Review URL: https://chromiumcodereview.appspot.com/10041013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/installer/mac/ChromeRemoteDesktop.packproj26
-rw-r--r--remoting/host/installer/mac/Chromoting.packproj30
-rwxr-xr-xremoting/host/installer/mac/Scripts/remoting_postflight.sh29
-rwxr-xr-xremoting/host/installer/mac/Scripts/remoting_preflight.sh34
4 files changed, 73 insertions, 46 deletions
diff --git a/remoting/host/installer/mac/ChromeRemoteDesktop.packproj b/remoting/host/installer/mac/ChromeRemoteDesktop.packproj
index 33d7df1..f089a1b 100644
--- a/remoting/host/installer/mac/ChromeRemoteDesktop.packproj
+++ b/remoting/host/installer/mac/ChromeRemoteDesktop.packproj
@@ -317,8 +317,6 @@
<integer>0</integer>
<key>Path</key>
<string></string>
- <key>Path Type</key>
- <integer>1</integer>
</dict>
<key>License</key>
<dict>
@@ -328,8 +326,6 @@
<integer>0</integer>
<key>Path</key>
<string></string>
- <key>Path Type</key>
- <integer>1</integer>
</dict>
</dict>
<key>ReadMe</key>
@@ -340,8 +336,6 @@
<integer>0</integer>
<key>Path</key>
<string></string>
- <key>Path Type</key>
- <integer>1</integer>
</dict>
</dict>
<key>Welcome</key>
@@ -352,8 +346,6 @@
<integer>0</integer>
<key>Path</key>
<string></string>
- <key>Path Type</key>
- <integer>1</integer>
</dict>
</dict>
</dict>
@@ -366,7 +358,7 @@
<key>Imported Options</key>
<dict>
<key>IFPkgFlagInstalledSize</key>
- <integer>19572</integer>
+ <integer>19544</integer>
</dict>
<key>Imported Package</key>
<true/>
@@ -458,9 +450,11 @@
<key>IFInstallationScriptsPreflight</key>
<dict>
<key>Path</key>
- <string></string>
+ <string>build/Chromoting.pkg/Contents/Resources/preflight</string>
+ <key>Path Type</key>
+ <integer>2</integer>
<key>Status</key>
- <false/>
+ <true/>
</dict>
<key>IFInstallationScriptsPreinstall</key>
<dict>
@@ -493,13 +487,13 @@
<key>IFPkgDescriptionTitle</key>
<string>Chromoting</string>
<key>IFPkgDescriptionVersion</key>
- <string>0.2</string>
+ <string>1.4.6</string>
</dict>
</dict>
<key>Display Information</key>
<dict>
<key>CFBundleGetInfoString</key>
- <string>Chromoting 0.2 Copyright © 2012 The Chromium Authors.</string>
+ <string>Chromoting 1.4.6 Copyright © 2012 The Chromium Authors.</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIconFile Path Type</key>
@@ -509,7 +503,7 @@
<key>CFBundleName</key>
<string>Chromoting</string>
<key>CFBundleShortVersionString</key>
- <string>0.2</string>
+ <string>1.4.6</string>
</dict>
<key>Options</key>
<dict>
@@ -535,9 +529,9 @@
<key>Version</key>
<dict>
<key>IFMajorVersion</key>
- <integer>0</integer>
+ <integer>1</integer>
<key>IFMinorVersion</key>
- <integer>2</integer>
+ <integer>4</integer>
</dict>
</dict>
</dict>
diff --git a/remoting/host/installer/mac/Chromoting.packproj b/remoting/host/installer/mac/Chromoting.packproj
index d35ce06..0fcf9b4 100644
--- a/remoting/host/installer/mac/Chromoting.packproj
+++ b/remoting/host/installer/mac/Chromoting.packproj
@@ -272,22 +272,6 @@
<key>GID</key>
<integer>80</integer>
<key>Path</key>
- <string>PrivilegedHelperTools/org.chromium.chromoting.json</string>
- <key>Path Type</key>
- <integer>2</integer>
- <key>Privileges</key>
- <integer>420</integer>
- <key>Type</key>
- <integer>3</integer>
- <key>UID</key>
- <integer>0</integer>
- </dict>
- <dict>
- <key>Children</key>
- <array/>
- <key>GID</key>
- <integer>80</integer>
- <key>Path</key>
<string>PrivilegedHelperTools/org.chromium.chromoting.me2me.sh</string>
<key>Path Type</key>
<integer>2</integer>
@@ -530,11 +514,11 @@
<key>IFInstallationScriptsPreflight</key>
<dict>
<key>Path</key>
- <string></string>
+ <string>Scripts/remoting_preflight.sh</string>
<key>Path Type</key>
<integer>2</integer>
<key>Status</key>
- <false/>
+ <true/>
</dict>
<key>IFInstallationScriptsPreinstall</key>
<dict>
@@ -596,13 +580,13 @@
<key>IFPkgDescriptionTitle</key>
<string>Chromoting</string>
<key>IFPkgDescriptionVersion</key>
- <string>0.2</string>
+ <string>1.4.6</string>
</dict>
</dict>
<key>Display Information</key>
<dict>
<key>CFBundleGetInfoString</key>
- <string>Chromoting 0.2 Copyright © 2012 The Chromium Authors.</string>
+ <string>Chromoting 1.4.6 Copyright © 2012 The Chromium Authors.</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIconFile Path Type</key>
@@ -612,7 +596,7 @@
<key>CFBundleName</key>
<string>Chromoting</string>
<key>CFBundleShortVersionString</key>
- <string>0.2</string>
+ <string>1.4.6</string>
</dict>
<key>Options</key>
<dict>
@@ -638,9 +622,9 @@
<key>Version</key>
<dict>
<key>IFMajorVersion</key>
- <integer>0</integer>
+ <integer>1</integer>
<key>IFMinorVersion</key>
- <integer>2</integer>
+ <integer>4</integer>
</dict>
</dict>
</dict>
diff --git a/remoting/host/installer/mac/Scripts/remoting_postflight.sh b/remoting/host/installer/mac/Scripts/remoting_postflight.sh
index 0b30ed2..2f72af4 100755
--- a/remoting/host/installer/mac/Scripts/remoting_postflight.sh
+++ b/remoting/host/installer/mac/Scripts/remoting_postflight.sh
@@ -8,6 +8,8 @@ HELPERTOOLS=/Library/PrivilegedHelperTools
NAME=org.chromium.chromoting
AUTH_FILE="$HELPERTOOLS/$NAME.json"
PLIST=/Library/LaunchAgents/org.chromium.chromoting.plist
+ENABLED_FILE="$HELPERTOOLS/$NAME.me2me_enabled"
+ENABLED_FILE_BACKUP="$ENABLED_FILE.backup"
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
KSUPDATE=https://tools.google.com/service/update2
@@ -22,9 +24,13 @@ function onexit {
exit 0
}
-# Update owner and permissions for auth file.
-chown $USER "$AUTH_FILE"
-chmod 600 "$AUTH_FILE"
+# Create auth file (with correct owner and permissions) if it doesn't already
+# exist.
+if [[ ! -f "$AUTH_FILE" ]]; then
+ touch "$AUTH_FILE"
+ chown $USER "$AUTH_FILE"
+ chmod 600 "$AUTH_FILE"
+fi
# Load the service.
# The launchctl command we'd like to run:
@@ -36,10 +42,19 @@ chmod 600 "$AUTH_FILE"
# 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
+USERNAME=$1
+USERID=$2
+if [[ -n "$USERNAME" && -n "$USERID" ]]; then
+ launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl load -w -S Aqua "$PLIST"
+fi
+
+# If there is a backup _enabled file, re-enable the service.
+if [[ -f "$ENABLED_FILE_BACKUP" ]]; then
+ mv "$ENABLED_FILE_BACKUP" "$ENABLED_FILE"
+ if [[ -n "$USERNAME" && -n "$USERID" ]]; then
+ launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl start -w -S Aqua "$NAME"
+ fi
fi
# Register a ticket with Keystone so we're updated.
-$KSADMIN --register --productid $KSPID --version $KSPVERSION --xcpath $PLIST --url $KSUPDATE
+$KSADMIN --register --productid "$KSPID" --version "$KSPVERSION" --xcpath "$PLIST" --url "$KSUPDATE"
diff --git a/remoting/host/installer/mac/Scripts/remoting_preflight.sh b/remoting/host/installer/mac/Scripts/remoting_preflight.sh
new file mode 100755
index 0000000..52bf3ea
--- /dev/null
+++ b/remoting/host/installer/mac/Scripts/remoting_preflight.sh
@@ -0,0 +1,34 @@
+#!/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
+ENABLED_FILE="$HELPERTOOLS/$NAME.me2me_enabled"
+ENABLED_FILE_BACKUP="$ENABLED_FILE.backup"
+
+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
+}
+
+# If there is an _enabled file, rename it while upgrading.
+if [[ -f "$ENABLED_FILE" ]]; then
+ mv "$ENABLED_FILE" "$ENABLED_FILE_BACKUP"
+fi
+
+# Stop and unload the service.
+set `ps aux | grep loginwindow.app | grep -v grep`
+USERNAME=$1
+USERID=$2
+if [[ -n "$USERNAME" && -n "$USERID" ]]; then
+ launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl stop "$NAME"
+ launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl unload -w -S Aqua "$PLIST"
+fi