#!/bin/bash
set -e
This script applies an installer configuration It needs to be run before installing TeamViewer
as root (or with sudo).
This script is an example for documentation and testing purposes. It is provided "as is" without
any warranty or support.
if (( $# == 0 )); then
echo "Usage: $(basename $0) <router1> [<router2>, ...]" >&2
exit 1
fi
JSON_ARRAY="["
ELEMENT_SEP=""
for ARG in "$@"; do
JSON_ARRAY+="${ELEMENT_SEP}\"${ARG}\""
ELEMENT_SEP=", "
done
JSON_ARRAY+="]"
if [ "${EUID}" -ne 0 ]; then
echo "This script needs to be run as root (or with sudo)." >&2
exit 1
fi
if [ -e "/Applications/TeamViewer.app" ]; then
echo "TeamViewer is already installed. You will have to install it again for the settings to take effect!"
fi
if [ -e "/Applications/TeamViewerHost.app" ]; then
echo "TeamViewer Host is already installed. You will have to install it again for the settings to take effect!"
fi
mkdir -p "/Library/Application Support/com.teamviewer.configuration"
cat >"/Library/Application Support/com.teamviewer.configuration/InstallerConfiguration.json" <<EOF
{
"ServerEnvironment": "us",
"ConditionalAccessRouters": ${JSON_ARRAY}
}
EOF