summaryrefslogtreecommitdiffstats
path: root/remoting/host/installer/mac/PrivilegedHelperTools/org.chromium.chromoting.me2me.sh
blob: a033362bf44845cf393ac0e66a405da13265474f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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.

NAME=org.chromium.chromoting
CONFIG_DIR=/Library/PrivilegedHelperTools
HOST_EXE=$CONFIG_DIR/$NAME.me2me_host
ENABLED_FILE=$CONFIG_DIR/$NAME.me2me_enabled
CONFIG_FILE=$CONFIG_DIR/$NAME.json

if [ "$1" = "--disable" ]; then
  # This script is executed from base::mac::ExecuteWithPrivilegesAndWait(),
  # which requires the child process to write its PID to stdout before
  # anythine else. See base/mac/authorization_util.h for details.
  echo $$
  rm -f "$ENABLED_FILE"
elif [ "$1" = "--enable" ]; then
  echo $$
  cat > "$CONFIG_FILE"
  touch "$ENABLED_FILE"
elif [ "$1" = "--save-config" ]; then
  echo $$
  cat > "$CONFIG_FILE"
else
  exec "$HOST_EXE" \
    --auth-config="$CONFIG_FILE" \
    --host-config="$CONFIG_FILE"
fi