Repository URL to install this package:
|
Version:
14.5.1691-1 ▾
|
function hasRepository()
{
[ "$TV_PKGTYPE" == 'DEB' ]
}
function ConfigureUpateDEB()
{
hasRepository || return 0
cmdExists apt-key || return
apt-key add "$TV_SCRIPT_DIR/TeamViewer2017.asc" &> "$TV_BASE_DIR/logfiles/signaturekey.log"
}
function PrintHelpRepo()
{
hasRepository || return
ABecho 'teamviewer repo' 'show current repository configuration'
ABecho 'teamviewer repo list' 'list available packages'
ABecho 'teamviewer repo default' 'restore default configuration'
ABecho 'teamviewer repo disable' 'disable repository updates'
ABecho 'teamviewer repo stable' 'make all regular TeamViewer packages available (default)'
ABecho 'teamviewer repo preview' 'additionally, make feature preview packages available'
echo
}
function Run_Repository()
{
local action="$1"
local param="$2" # unused
local stableStr=
local default='/opt/teamviewer/tv_bin/script/teamviewer.list'
local repoFile='/etc/apt/sources.list.d/teamviewer.list'
hasRepository || return 0
echo
if [ -n "$action" ]; then
case "$action" in
( default ) RepoDefault ;;
( disable ) RepoDisable ;;
( stable | preview ) RepoEnable ;;
( list ) RepoList; return ;;
( level ) RepoLevel; exit 1 ;; # for internal use
( * ) die "Unknown option '$action'"
esac
fi
RepoConfig
}
function RepoCheckSuperUser()
{
isSuperUser || die 'You need root permissions for this operation'
}
function RepoDefault()
{
RepoCheckSuperUser
echo "Restoring defaults from $default ..."
cp $default $repoFile
}
function RepoDisable()
{
RepoCheckSuperUser
echo "Disabling repository ..."
RepoRemove
}
function RepoEnable()
{
RepoCheckSuperUser
echo "Enabling $action repository $stableStr..."
RepoRemove
RepoAdd
}
function RepoList()
{
echo "Available TeamViewer packages"
echo
cmdExists apt-cache || die 'apt-cache not found'
local data="$(apt-cache madison teamviewer teamviewer-host 2>/dev/null | sed -e 's/teamviewer |/teamviewer |/g')"
echo "$data" | grep -q teamviewer || { Yecho 'No packages found. Make sure the repository is enabled (teamviewer repo default) and up to date (apt update)'; return; }
echo "$data"
}
function RepoRemove()
{
grep -v -e '^\s*#*\s*deb ' $default > $repoFile
}
function RepoAdd()
{
echo "# Modified via 'teamviewer repo' command" >> $repoFile
RepoAddLine stable main >> $repoFile
RepoAddLine preview main >> $repoFile
RepoAddLine development main >> $repoFile
}
function RepoAddLine()
{
local dist=$1
local component=$2
local repoUri="deb http://linux.teamviewer.com/deb $dist $component"
local prefix=
EnableEntry || prefix='### '
echo "${prefix}$repoUri"
}
function EnableEntry()
{
[ $action = stable ] && return $([ $dist = stable ]) # add stable only
[ $action = preview ] && return $([ $dist != development ]) # add all components, except development
[ $action = development ] && return 0 # add all components
return 1
}
function RepoConfig()
{
BDecho "Active configuration lines in '$repoFile':"
RepoConfigLines
if (( $? != 0 )); then
echo '< repository disabled / no active configuration lines >'
fi
echo
}
function RepoLevel()
{
RepoConfigContains 'stable main' || exit 10 # none
RepoConfigContains 'preview main' || exit 11 # stable
RepoConfigContains 'development main' || exit 12 # preview
exit 13 # development
}
function RepoConfigContains()
{
RepoConfigLines | grep -q "$1"
}
function RepoConfigLines()
{
grep -e '^\s*deb ' "$repoFile"
}