From 52cb4739432527b6f97e96109e186b3a78363651 Mon Sep 17 00:00:00 2001 From: Manuel Friedli Date: Mon, 1 Sep 2008 21:28:39 +0000 Subject: [PATCH] added ebuild for skype-2.0.0.72 --- net-im/skype/files/sDaemonWrapper-r1 | 67 ++++++++++++++++++++ net-im/skype/files/skype-callto-handler | 83 +++++++++++++++++++++++++ net-im/skype/files/skype.debus.config | 10 +++ net-im/skype/files/skype.sh | 11 ++++ 4 files changed, 171 insertions(+) create mode 100644 net-im/skype/files/sDaemonWrapper-r1 create mode 100755 net-im/skype/files/skype-callto-handler create mode 100644 net-im/skype/files/skype.debus.config create mode 100644 net-im/skype/files/skype.sh diff --git a/net-im/skype/files/sDaemonWrapper-r1 b/net-im/skype/files/sDaemonWrapper-r1 new file mode 100644 index 0000000..9002961 --- /dev/null +++ b/net-im/skype/files/sDaemonWrapper-r1 @@ -0,0 +1,67 @@ +#!/bin/bash +# +# Wrapper script to run Skype with sound wrapper when possible +logfile="${HOME}/.Skype/skype.log" +progname="skype" +progpath="/opt/${progname}/" +progopts="--resources-path ${progpath}" +shellcheck1=` which artsshell 2> /dev/null ` +shellcheck2=` which esd 2> /dev/null ` +artsdcheck=` ps x | grep artsd | grep -v grep ` +## We use ps ax for esd as esd can be used globaly for all users. +esdcheck=` ps ax | grep "esd ." | grep -v grep ` +skypecmd="${progpath}${progname}.bin" +wrapsound="yes" + +#Use 32bits wrapper in 64 bits system +xdspsuffix="" +if [ `uname -m` == "x86_64" ]; then + xdspsuffix=32 +fi + +[ "$1" == "oss" ] && wrapsound="no" + +[ -d "$(dirname "${logfile}")" ] || mkdir "$(dirname "${logfile}")" + +echo "===== " `date` " =====" > ${logfile} +if [[ -z ${shellcheck1} && -z ${shellcheck2} ]] +then + echo "No installed artsshell or esd found" + echo "Assuming you're running no sound daemon" + echo "Starting ${progname} without a sound wrapper" | tee --append "${logfile}" +else + if [[ ${wrapsound} == "yes" && ${shellcheck1} == $(artsc-config --arts-prefix)/bin/artsshell && -n ${artsdcheck} ]] + then + echo "Running artsd found" + echo "Starting artsd wrapped ${progname}" | tee --append "${logfile}" + skypecmd="env MALLOC_CHECK_=0 artsdsp${xdspsuffix} -m ${skypecmd}" + elif [[ ${wrapsound} == "yes" && ${shellcheck2} == /usr/bin/esd && -n ${esdcheck} ]] + then + echo "Running esd found" + echo "Starting esd wrapped ${progname}" | tee --append "${logfile}" + skypecmd="esddsp${xdspsuffix} ${skypecmd}" + else + if [ ${wrapsound} == "yes" ] + then + echo "No running artsd or esd found" + else + echo "Use of sound-daemon disabled" + fi + echo "Starting ${progname} without sound daemon" | tee --append "${logfile}" + fi +fi + +#Going to "homedir" +cd ${progpath} +echo "${skypecmd} ${progopts}" >> ${logfile} +echo "==========================================" +${skypecmd} ${progopts} >> ${logfile} 2>> ${logfile} + +if [[ $? -ne 0 ]] ; then + echo "Running wrapped Skype failed, trying not-wrapped mode..." + echo "==========================================" + skypecmd="${progpath}${progname}.bin" + ${skypecmd} ${progopts} >> ${logfile} 2>&1 +fi + +exit $? diff --git a/net-im/skype/files/skype-callto-handler b/net-im/skype/files/skype-callto-handler new file mode 100755 index 0000000..e4614d7 --- /dev/null +++ b/net-im/skype/files/skype-callto-handler @@ -0,0 +1,83 @@ +#!/bin/sh + +SKYPE="skype" +DBUS_SEND="dbus-send" +BUS="--system" +SKYPE_BUS="" +ID=`id -u` + +print_help() +{ + cat << EOF +Skype "callto://" handler + Usage: skype-callto-handler [BUS] callto://user + Where BUS can be either "--system" (default) or "--session" +EOF +} + +if [ -z "$1" -o "$1" = "--help" ]; then + print_help + exit 1 +fi + +if [ "--system" = "$1" -o "--session" = "$1" ];then + BUS="$1" + shift 1 +fi + +if [ "--session" = "$BUS" ]; then + SKYPE_BUS="--use-session-dbus" +fi + +if [ -z "$1" ];then + print_help + exit 1 +fi + +CALLTO=`echo $1 | sed 's/callto:\/\///'` + +PING=`$DBUS_SEND $BUS --type=method_call --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ServiceExists string:com.Skype.API 2> /dev/null`; RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "ERROR: Failed to connect to DBUS daemon!" + exit 1 +fi + +echo "$PING" | grep -q "boolean:true"; RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "Running Skype instance not found, launching" + $SKYPE $SKYPE_BUS --callto "$CALLTO" & + exit 0 +fi + +SKYPE_ID=`$DBUS_SEND $BUS --type=method_call --print-reply --dest=com.Skype.API /com/Skype com.Skype.API.Ping 2> /dev/null`;RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "ERROR: Skype is running on specified bus, but is misbehaving!" + exit 1 +fi + +TEMP=`echo "$SKYPE_ID" | grep -o "int32:[0-9]*"` + +SKYPE_ID=`echo "$TEMP" | cut -f2 -d':'` + +if [ $ID -ne $SKYPE_ID ]; then + echo "ERROR: Skype is running on specified bus, but for different UNIX user!" + exit 1 +fi + +REPLY=`$DBUS_SEND $BUS --type=method_call --print-reply --dest=com.Skype.API /com/Skype com.Skype.API.Invoke string:CALL\ $CALLTO 2> /dev/null`;RESULT=$? + +if [ $RESULT -ne 0 ]; then + echo "ERROR: Error when communicating with Skype!" + exit 1 +fi + +TEMP=`echo "$REPLY" | grep -o "string:.*"` + +REPLY=`echo "$TEMP" | cut -f2 -d':'` + +echo $REPLY + +exit 0 diff --git a/net-im/skype/files/skype.debus.config b/net-im/skype/files/skype.debus.config new file mode 100644 index 0000000..641647f --- /dev/null +++ b/net-im/skype/files/skype.debus.config @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/net-im/skype/files/skype.sh b/net-im/skype/files/skype.sh new file mode 100644 index 0000000..6c78c9a --- /dev/null +++ b/net-im/skype/files/skype.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# +progname="skype" +progpath="/opt/${progname}/" +progopts="--resources-path ${progpath}" + + +#Going to "homedir" +cd ${progpath} +skypecmd="${progpath}${progname}" +XMODIFIERS=@im=none QT_IM_MODULE=simple exec ${skypecmd} ${progopts} $@