| 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@@ | 7 # Version = @@VERSION@@ |
| 8 | 8 |
| 9 HELPERTOOLS=/Library/PrivilegedHelperTools | 9 HELPERTOOLS=/Library/PrivilegedHelperTools |
| 10 NAME=org.chromium.chromoting | 10 NAME=org.chromium.chromoting |
| 11 CONFIG_FILE="$HELPERTOOLS/$NAME.json" | 11 CONFIG_FILE="$HELPERTOOLS/$NAME.json" |
| 12 PLIST=/Library/LaunchAgents/org.chromium.chromoting.plist | 12 PLIST=/Library/LaunchAgents/org.chromium.chromoting.plist |
| 13 PAM_CONFIG=/etc/pam.d/chrome-remote-desktop | 13 PAM_CONFIG=/etc/pam.d/chrome-remote-desktop |
| 14 ENABLED_FILE="$HELPERTOOLS/$NAME.me2me_enabled" | 14 ENABLED_FILE="$HELPERTOOLS/$NAME.me2me_enabled" |
| 15 ENABLED_FILE_BACKUP="$ENABLED_FILE.backup" | 15 ENABLED_FILE_BACKUP="$ENABLED_FILE.backup" |
| 16 LOG_FILE=/var/log/org.chromium.chromoting.log |
| 16 | 17 |
| 17 KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Content
s/MacOS/ksadmin | 18 KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Content
s/MacOS/ksadmin |
| 18 KSUPDATE=https://tools.google.com/service/update2 | 19 KSUPDATE=https://tools.google.com/service/update2 |
| 19 KSPID=com.google.chrome_remote_desktop | 20 KSPID=com.google.chrome_remote_desktop |
| 20 KSPVERSION=@@VERSION@@ | 21 KSPVERSION=@@VERSION@@ |
| 21 | 22 |
| 22 trap on_error ERR | 23 trap on_error ERR |
| 23 | 24 |
| 24 function on_error { | 25 function on_error { |
| 25 logger An error occurred during Chrome Remote Desktop setup. | 26 logger An error occurred during Chrome Remote Desktop setup. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 56 password required pam_deny.so | 57 password required pam_deny.so |
| 57 session required pam_deny.so | 58 session required pam_deny.so |
| 58 | 59 |
| 59 # This file is auto-updated by the Chrome Remote Desktop installer. | 60 # This file is auto-updated by the Chrome Remote Desktop installer. |
| 60 $CONTROL_LINE | 61 $CONTROL_LINE |
| 61 EOF | 62 EOF |
| 62 else | 63 else |
| 63 logger PAM config has local edits. Not updating. | 64 logger PAM config has local edits. Not updating. |
| 64 fi | 65 fi |
| 65 | 66 |
| 67 # Create the log file (if this isn't created ahead of time |
| 68 # then directing output from the service there won't work). |
| 69 # Make sure admins have write privileges (CRD users are |
| 70 # typically admins) |
| 71 touch "$LOG_FILE" |
| 72 chown :admin "$LOG_FILE" |
| 73 chmod 660 "$LOG_FILE" |
| 74 |
| 66 # Load the service. | 75 # Load the service. |
| 67 # The launchctl command we'd like to run: | 76 # The launchctl command we'd like to run: |
| 68 # launchctl load -w -S Aqua $PLIST | 77 # launchctl load -w -S Aqua $PLIST |
| 69 # However, since we're installing as an admin, the launchctl command is run | 78 # However, since we're installing as an admin, the launchctl command is run |
| 70 # as if it had a sudo prefix, which means it tries to load the service in | 79 # as if it had a sudo prefix, which means it tries to load the service in |
| 71 # system rather than user space. | 80 # system rather than user space. |
| 72 # To launch the service in user space, we need to get the current user (using | 81 # To launch the service in user space, we need to get the current user (using |
| 73 # ps and grepping for the loginwindow.app) and run the launchctl cmd as that | 82 # ps and grepping for the loginwindow.app) and run the launchctl cmd as that |
| 74 # user (using launchctl bsexec). | 83 # user (using launchctl bsexec). |
| 75 set `ps aux | grep loginwindow.app | grep -v grep` | 84 set `ps aux | grep loginwindow.app | grep -v grep` |
| 76 USERNAME=$1 | 85 USERNAME=$1 |
| 77 USERID=$2 | 86 USERID=$2 |
| 78 if [[ -n "$USERNAME" && -n "$USERID" ]]; then | 87 if [[ -n "$USERNAME" && -n "$USERID" ]]; then |
| 79 launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl load -w -S Aqua "$PLI
ST" | 88 launchctl bsexec "$USERID" sudo -u "$USERNAME" launchctl load -w -S Aqua "$PLI
ST" |
| 80 fi | 89 fi |
| OLD | NEW |