summaryrefslogtreecommitdiff
blob: ab9c935289f5bf334cc7e532a932747eda3aeb1a (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
53
54
55
56
57
58
59
60
61
#!/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} == $(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 -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

#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 $?