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 NAME=org.chromium.chromoting | 9 NAME=org.chromium.chromoting |
10 CONFIG_DIR=/Library/PrivilegedHelperTools | 10 CONFIG_DIR=/Library/PrivilegedHelperTools |
(...skipping 27 matching lines...) Expand all Loading... |
38 SIGSTOP SIGTSTP SIGCONT SIGCHLD SIGTTIN SIGTTOU SIGIO SIGXCPU SIGXFSZ \ | 38 SIGSTOP SIGTSTP SIGCONT SIGCHLD SIGTTIN SIGTTOU SIGIO SIGXCPU SIGXFSZ \ |
39 SIGVTALRM SIGPROF SIGWINCH SIGINFO SIGUSR1 SIGUSR2 | 39 SIGVTALRM SIGPROF SIGWINCH SIGINFO SIGUSR1 SIGUSR2 |
40 | 40 |
41 while true; do | 41 while true; do |
42 if [[ ! -f "$ENABLED_FILE" ]]; then | 42 if [[ ! -f "$ENABLED_FILE" ]]; then |
43 echo "Daemon is disabled." | 43 echo "Daemon is disabled." |
44 exit 0 | 44 exit 0 |
45 fi | 45 fi |
46 | 46 |
47 # Execute the host asynchronously | 47 # Execute the host asynchronously |
48 "$HOST_EXE" --auth-config="$CONFIG_FILE" --host-config="$CONFIG_FILE" & | 48 "$HOST_EXE" --host-config="$CONFIG_FILE" & |
49 HOST_PID="$!" | 49 HOST_PID="$!" |
50 | 50 |
51 # Wait for the host to return and process its exit code. | 51 # Wait for the host to return and process its exit code. |
52 while true; do | 52 while true; do |
53 wait "$HOST_PID" | 53 wait "$HOST_PID" |
54 EXIT_CODE="$?" | 54 EXIT_CODE="$?" |
55 if [[ $SIGNAL_WAS_TRAPPED -eq 1 ]]; then | 55 if [[ $SIGNAL_WAS_TRAPPED -eq 1 ]]; then |
56 # 'wait' returned as the result of a trapped signal and the exit code is | 56 # 'wait' returned as the result of a trapped signal and the exit code is |
57 # the signal that was trapped + 128. Forward the signal to the host. | 57 # the signal that was trapped + 128. Forward the signal to the host. |
58 SIGNAL_WAS_TRAPPED=0 | 58 SIGNAL_WAS_TRAPPED=0 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 # Wait for the parent (System Preferences applet) to die, by reading from | 92 # Wait for the parent (System Preferences applet) to die, by reading from |
93 # stdin until the pipe is broken. | 93 # stdin until the pipe is broken. |
94 cat 2>/dev/null || true | 94 cat 2>/dev/null || true |
95 open "$PREF_PANE_BUNDLE" | 95 open "$PREF_PANE_BUNDLE" |
96 elif [[ "$1" = "--run-from-launchd" ]]; then | 96 elif [[ "$1" = "--run-from-launchd" ]]; then |
97 run_host | 97 run_host |
98 else | 98 else |
99 echo $$ | 99 echo $$ |
100 exit 1 | 100 exit 1 |
101 fi | 101 fi |
OLD | NEW |