| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Version = @@VERSION@@ |
| 8 |
| 7 HELPERTOOLS=/Library/PrivilegedHelperTools | 9 HELPERTOOLS=/Library/PrivilegedHelperTools |
| 8 NAME=org.chromium.chromoting | 10 NAME=org.chromium.chromoting |
| 9 CONFIG_FILE="$HELPERTOOLS/$NAME.json" | 11 CONFIG_FILE="$HELPERTOOLS/$NAME.json" |
| 10 PLIST=/Library/LaunchAgents/org.chromium.chromoting.plist | 12 PLIST=/Library/LaunchAgents/org.chromium.chromoting.plist |
| 11 ENABLED_FILE="$HELPERTOOLS/$NAME.me2me_enabled" | 13 ENABLED_FILE="$HELPERTOOLS/$NAME.me2me_enabled" |
| 12 ENABLED_FILE_BACKUP="$ENABLED_FILE.backup" | 14 ENABLED_FILE_BACKUP="$ENABLED_FILE.backup" |
| 13 | 15 |
| 14 trap onexit ERR | 16 trap onexit ERR |
| 15 | 17 |
| 16 function onexit { | 18 function onexit { |
| 17 # Log an error but don't report an install failure if this script has errors. | 19 # Log an error but don't report an install failure if this script has errors. |
| 18 logger An error occurred while launching the service | 20 logger An error occurred while launching the service |
| 19 exit 0 | 21 exit 0 |
| 20 } | 22 } |
| 21 | 23 |
| 24 logger Running Chrome Remote Desktop preflight script @@VERSION@@ |
| 25 |
| 22 # If there is an _enabled file, rename it while upgrading. | 26 # If there is an _enabled file, rename it while upgrading. |
| 23 if [[ -f "$ENABLED_FILE" ]]; then | 27 if [[ -f "$ENABLED_FILE" ]]; then |
| 24 mv "$ENABLED_FILE" "$ENABLED_FILE_BACKUP" | 28 mv "$ENABLED_FILE" "$ENABLED_FILE_BACKUP" |
| 25 fi | 29 fi |
| 26 | 30 |
| 27 # Stop and unload the service. | 31 # Stop and unload the service. |
| 28 set `ps aux | grep loginwindow.app | grep -v grep` | 32 set `ps aux | grep loginwindow.app | grep -v grep` |
| 29 USERNAME=$1 | 33 USERNAME=$1 |
| 30 USERID=$2 | 34 USERID=$2 |
| 31 if [[ -n "$USERNAME" && -n "$USERID" ]]; then | 35 if [[ -n "$USERNAME" && -n "$USERID" ]]; then |
| 32 launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl stop "$NAME" | 36 launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl stop "$NAME" |
| 33 launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl unload -w -S Aqua "$P
LIST" | 37 launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl unload -w -S Aqua "$P
LIST" |
| 34 fi | 38 fi |
| OLD | NEW |