From 48ed061e72d23131832814eb7cfb4bc2387630f2 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Fri, 15 Jul 2016 18:06:53 +0100 Subject: of course, I'm an idiot...fix teamviewer ebuild --- .../files/teamviewer-9.0.32150-gentoo.patch | 138 +++++++++++++++++++++ net-misc/teamviewer/files/teamviewer.sh | 47 +++++++ net-misc/teamviewer/files/teamviewerd.conf | 6 + net-misc/teamviewer/files/teamviewerd.init | 31 +++++ net-misc/teamviewer/files/teamviewerd9.init | 26 ++++ 5 files changed, 248 insertions(+) create mode 100644 net-misc/teamviewer/files/teamviewer-9.0.32150-gentoo.patch create mode 100644 net-misc/teamviewer/files/teamviewer.sh create mode 100644 net-misc/teamviewer/files/teamviewerd.conf create mode 100644 net-misc/teamviewer/files/teamviewerd.init create mode 100644 net-misc/teamviewer/files/teamviewerd9.init (limited to 'net-misc/teamviewer/files') diff --git a/net-misc/teamviewer/files/teamviewer-9.0.32150-gentoo.patch b/net-misc/teamviewer/files/teamviewer-9.0.32150-gentoo.patch new file mode 100644 index 00000000..1df46327 --- /dev/null +++ b/net-misc/teamviewer/files/teamviewer-9.0.32150-gentoo.patch @@ -0,0 +1,138 @@ +diff --git a/opt/teamviewer9/tv_bin/script/tvw_extra b/opt/teamviewer9/tv_bin/script/tvw_extra +index 71164aa..848cd25 100644 +--- a/opt/teamviewer9/tv_bin/script/tvw_extra ++++ b/opt/teamviewer9/tv_bin/script/tvw_extra +@@ -16,13 +16,6 @@ + isInstalledTV || return + ABecho "teamviewer --passwd [PASSWD]" "set a password (useful when installing remote (ssh)" + echo +- ABecho "teamviewer --daemon status" "show current status of the TeamViewer daemon" +- ABecho "teamviewer --daemon start" "start TeamViewer daemon" +- ABecho "teamviewer --daemon stop" "stop TeamViewer daemon" +- ABecho "teamviewer --daemon restart" "stop/start TeamViewer daemon" +- ABecho "teamviewer --daemon disable" "disable TeamViewer daemon - don't start daemon on system startup" +- ABecho "teamviewer --daemon enable" "enable TeamViewer daemon - start daemon on system startup (default)" +- echo + } + + function PrintVersion() +@@ -37,19 +30,6 @@ + PrintDaemonStatus + echo + PrintTeamViewerID +-} +- +-function PrintDaemonStatus() +-{ +- local cmd="$(daemonCtl 'status')" +- local txt="n/a" +- +- if [ isInstalledTV ] ; then +- txt="$(eval "$cmd")" +- [ $? = 0 ] || txt='n/a (error)' +- fi +- +- ABecho "teamviewerd status" "$txt" + } + + function PrintTeamViewerID() +@@ -64,20 +44,21 @@ + ABecho "TeamViewer ID:" "$tvid" + + if [ -z "$tvid" ] && isInstalledTV; then +- echo "Try restarting the TeamViewer daemon (e.g. teamviewer --daemon restart)" ++ echo "Try restarting the TeamViewer daemon." + fi + } + + function SetPasswd() + { ++ echo "Stop your teamviewer daemon first, then press enter." ++ read ++ + local pwd="$1" + [ -n "$pwd" ] || die 'no password specified' + + installedTVorDie + isSuperUser || die 'You need root permissions for this operation' + +- Run_Daemon 'stop' > /dev/null +- + "$TV_BIN_DIR/teamviewerd" --passwd "$pwd" + case $? in + 0 ) echo 'ok' ;; +@@ -88,12 +69,14 @@ + * ) echo 'unknown response' ;; + esac + +- Run_Daemon 'start' > /dev/null || die 'failed to restart the daemon' +- echo ++ echo "You may start your teamviewer daemon again." + } + + function ExportLicense() + { ++ echo "Stop your teamviewer daemon first, then press enter." ++ read ++ + local license="$1" + local path='/tmp/tv_global.conf' + +@@ -101,8 +84,6 @@ + + isSuperUser || die 'You need root permissions for this operation' + +- Run_Daemon 'stop' > /dev/null +- + "$TV_BIN_DIR/teamviewerd" --export-license "$license" "$path" + case $? in + 0 ) echo "ok - license exported to '$path'" ;; +@@ -110,8 +91,7 @@ + * ) echo 'unknown response' ;; + esac + +- Run_Daemon 'start' > /dev/null || die 'failed to restart the daemon' +- echo ++ echo "You may start your teamviewer daemon again." + } + + function StripPersonalInformation() +diff --git a/opt/teamviewer9/tv_bin/script/tvw_main b/opt/teamviewer9/tv_bin/script/tvw_main +index 8984db0..c6dff8d 100644 +--- a/opt/teamviewer9/tv_bin/script/tvw_main ++++ b/opt/teamviewer9/tv_bin/script/tvw_main +@@ -4,7 +4,6 @@ + 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" + + function Main() +@@ -18,7 +17,6 @@ + --help ) PrintHelp ;; + --version ) PrintVersion ;; + --info ) PrintInfo ;; +- --daemon ) Run_Daemon $opt ;; + --winecfg ) shift; Run_WineCfg "$@" ;; + --regedit ) shift; Run_RegEdit "$@" ;; + --kill ) Run_KillTeamViewer ;; +@@ -170,18 +168,3 @@ + Init + wine regedit "$@" + } +- +-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 +-} diff --git a/net-misc/teamviewer/files/teamviewer.sh b/net-misc/teamviewer/files/teamviewer.sh new file mode 100644 index 00000000..70fc4e8a --- /dev/null +++ b/net-misc/teamviewer/files/teamviewer.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +tv="$(basename $0)" +tvdir="/opt/${tv}" +version="@TVV@" +tvw_version="" +prefix="${HOME}/.wine-${tv}" +arch="win32" +native=true + +if $native; then + export WINEDLLPATH="${prefix}/drive_c/TeamViewer" +else + export WINEDLLPATH="${tvdir}/tv_bin/wine/lib:${tvdir}/tv_bin/wine/lib/wine:${prefix}/drive_c/TeamViewer" + export PATH="${tvdir}/tv_bin/wine/bin:${PATH}" +fi +export WINEARCH="${arch}" +export WINEPREFIX="${prefix}" + +if [ ! -d "${prefix}" ]; then + echo "Creating prefix..." + wineboot -i &> /dev/null + mkdir -p "${prefix}/drive_c/TeamViewer" +fi + +if [ -e "${prefix}/tvw-version" ]; then + tvw_version=$(<"${prefix}/tvw-version") +fi + +#If version has changed or new instance +if [ "${version}" != "${tvw_version}" ]; then + echo "Copying TeamViewer files to prefix..." + cp -R "/opt/${tv}/wine/drive_c/TeamViewer" "${prefix}/drive_c/" + echo "Creating config and log directories in ~/.config/teamviewer@TVMV@" + mkdir -p "${HOME}"/.config/teamviewer@TVMV@/{config,logfiles} + echo "${version}" > "${prefix}/tvw-version" +fi + +TV_BASE_DIR="${tvdir}" +TV_BIN_DIR="${TV_BASE_DIR}/tv_bin" +TV_PROFILE="${prefix}" +TV_LOG_DIR="${TV_PROFILE}/logfiles" +TV_CFG_DIR="${TV_PROFILE}/config" +TV_USERHOME="${HOME}" + +wine "C:\\TeamViewer\\TeamViewer.exe" "\${[@]}" &> \ + "${HOME}/.config/teamviewer@TVMV@/logfiles/$(date +%Y.%m.%d-%H:%M:%S)-wine.log" diff --git a/net-misc/teamviewer/files/teamviewerd.conf b/net-misc/teamviewer/files/teamviewerd.conf new file mode 100644 index 00000000..e9496606 --- /dev/null +++ b/net-misc/teamviewer/files/teamviewerd.conf @@ -0,0 +1,6 @@ +# This entry can be used to specify a default daemon password. +# It is set by running /etc/init.d/teamviewerd@TVV@ passwd. +# The password must be between 8 and 12 characters, and special characters should +# be avoided. + +PASSWD="" diff --git a/net-misc/teamviewer/files/teamviewerd.init b/net-misc/teamviewer/files/teamviewerd.init new file mode 100644 index 00000000..a8966dc1 --- /dev/null +++ b/net-misc/teamviewer/files/teamviewerd.init @@ -0,0 +1,31 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +command=/opt/teamviewer@TVV@/tv_bin/teamviewerd +command_args=-d +description="daemon for TeamViewer" +pidfile=/var/run/teamviewerd.pid + +extra_stopped_commands="passwd" + +passwd() { + if [ -z "${PASSWD}" ]; then + eerror "No password specified." + exit 1 + fi + + ebegin "Attempting to change password." + /opt/teamviewer@TVV@/tv_bin/teamviewerd --passwd "${PASSWD}" + retr=$? + case $retr in + 0) einfo "Password successfully set." ;; + 11|12) eerror "Password must be between 8 and 12 characters.";; + 13) eerror "Invalid characters detected.";; + 14) eerror "Password invalid. Validation failed.";; + *) eerror "Unknown error code";; + esac + eend $retr + exit $retr +} diff --git a/net-misc/teamviewer/files/teamviewerd9.init b/net-misc/teamviewer/files/teamviewerd9.init new file mode 100644 index 00000000..80e881eb --- /dev/null +++ b/net-misc/teamviewer/files/teamviewerd9.init @@ -0,0 +1,26 @@ +#!/sbin/openrc-run +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +description="daemon for TeamViewer" + +PIDFILE="/var/run/teamviewerd.pid" + +start() { + ebegin "Starting Teamviewer Daemon" + + start-stop-daemon \ + --start \ + --pidfile "${PIDFILE}" \ + --background \ + --exec /opt/teamviewer@TVV@/teamviewerd -- -d +} + +stop() { + ebegin "Stopping Teamviewer Daemon" + + start-stop-daemon \ + --stop \ + --pidfile "${PIDFILE}" +} -- cgit v1.2.3