summaryrefslogtreecommitdiff
blob: ac55641240bfc50f96fa69205b9d5b05b1d18e11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/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"

[ "$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} == ${KDEDIR}/bin/artsshell && -n ${artsdcheck} ]]
	then
		echo "Running artsd found"
		echo "Starting artsd wrapped ${progname}" | tee ---append "${logfile}"
		skypecmd="artsdsp -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 ${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

echo "${skypecmd} ${progopts}" >> ${logfile}
echo "=========================================="
${skypecmd} ${progopts} >> ${logfile} 2>> ${logfile}

exit $?