Repository URL to install this package:
|
Version:
14.5.1691-1 ▾
|
source "$TV_SCRIPT_DIR/tvw_aux"
source "$TV_SCRIPT_DIR/tvw_config"
source "$TV_SCRIPT_DIR/tvw_exec"
source "$TV_SCRIPT_DIR/tvw_extra"
source "$TV_SCRIPT_DIR/tvw_daemon"
source "$TV_SCRIPT_DIR/tvw_profile"
source "$TV_SCRIPT_DIR/tvw_update"
function Main()
{
local action="$(ActionTrim "$1")"
local opt="$2"
set -o pipefail
echo
case "$action" in
'help' ) PrintHelp ;;
'version' ) PrintVersion ;;
'info' ) PrintInfo ;;
'ziplog' ) CreateZipLog ;;
'license' ) Run_Config --license "$opt" ;;
'passwd' ) SetPasswd "$opt" ;;
'daemon' ) Run_Daemon $opt ;;
'setup' ) Run_Config "$@" ;;
'repo' | 'repository' ) shift; Run_Repository "$@" ;;
'uninstall' ) UninstallTAR "$opt" ;;
'ps' ) ListProcesses ps ;;
'pstree' ) ListProcesses tree ;;
'export-license' ) ExportLicense "$opt" ;;
* ) Run_TeamViewer "$@" ;;
esac
echo
}
function ActionTrim()
{
local param="$1"
local trim=0
[[ "$param" = -* ]] && trim=1
[[ "$param" = --* ]] && trim=2
echo "${param:$trim}"
}
function Init()
{
local opt="$1"
exec 2>&1 # redirect stderr
InitDirs || die "InitDirs failed. ($?)" # needed for log
echo "Init..." | TeeLog reset # truncate startup log
validateUser || exit 1
LogStartupInfo | Log || die "Init failed. Please check '$TV_STARTLOG'"
CheckCPU
CheckEnvironment # no pipe, no subshell
UpdateBinaries | Log || die "UpdateBinaries failed. Please check '$TV_STARTLOG'"
echo "Checking setup..."
# no pipe/subshell due to InitFonts
InitProfile >> "$TV_STARTLOG" || die "InitProfile failed. Please check '$TV_STARTLOG'"
}
function InitDirs()
{
cd "$TV_BASE_DIR" || return 1 # fonts_portable uses relative path
make_path "$TV_LOG_DIR" || return 2 # needed by LockStartup
make_path "$TV_CFG_DIR" || return 3
}
function CheckCPU()
{
local -r arch="$(uname -m)"
local check='CheckCPU: SSE2 support: yes'
case "$arch" in
( i686 | x86_64 )
if ! grep -q -w sse2 /proc/cpuinfo; then
check="${check/yes/not found. TeamViewer cannot start}"
echo "$check" | Log
die "$check"
fi
;;
( armv7l )
check='CheckCPU: armv7l'
;;
( * )
die "CheckCPU: unknown architecture '$arch'"
esac
echo "$check" | TeeLog
}
function CheckEnvironment()
{
isQuickSupport || return
[ -n "$LD_PRELOAD" ] || return
echo "Removing LD_PRELOAD='$LD_PRELOAD'"
unset LD_PRELOAD
}
function LogStartupInfo()
{
HeadEcho "TeamViewer:" "$TV_VERSION - $TV_PKGTYPE"
HeadEcho "Profile:" "$HOME ($LOGNAME)"
HeadEcho "Desktop:" "DS: '$DESKTOP_SESSION' XDG: '$XDG_CURRENT_DESKTOP'"
HeadEcho "XServer TTY:" "$(InfoXServerTTY)"
echo
echo "ok (info)"
echo
}
function InfoXServerTTY()
{
local xfvt=
cmdExists xprop && xfvt=$(xprop -root XFree86_VT | grep INTEGER | cut -f2 -d=)
xfvt=${xfvt:-'none'}
echo $xfvt
}
function Run_TeamViewer()
{
local inst=
local logPath="$TV_LOG_DIR/gui.log"
isInstalledTV || inst='-n'
LockStartup # terminates on failure
Init 'runGui'
echo 'Launching TeamViewer ...'
RequireNetwork
echo 'Launching TeamViewer GUI ...'
UnlockStartup
exec $TV_BIN_DIR/TeamViewer $inst "$@" &> "$logPath"
}
function Run_Daemon()
{
local opt="$1"
installedTVorDie
case "$opt" in
( disable ) removeDaemon || rootSuggest ;;
( enable ) installDaemon || rootSuggest ;;
( start | stop | restart ) cmdDaemon $opt || rootSuggest ;;
( status ) cmdDaemon $opt ;;
( * ) echo "unknown option '$opt'" ;;
esac
}
function Run_Config()
{
local tvconfig="$TV_BIN_DIR/teamviewer-config"
[ -z "$DISPLAY" ] && export TV_SESSIONTYPE=F
exec "$tvconfig" "$@"
}
function UninstallTAR()
{
local force="$1"
local instSetup="$TV_SCRIPT_DIR/teamviewer_setup"
[ "$TV_PKGTYPE" == "TAR_IN" ] || return
"$instSetup" uninstall "$force"
}