Remove all bashisms; drop grml-muttng
[grml-scripts.git] / usr_bin / soundtest
1 #!/bin/sh
2 # Filename:      soundtest
3 # Purpose:       test sound on your grml system
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2.
7 ################################################################################
8
9 PN=`basename "$0"`
10
11 if [ -z "$PLAYER" ] ; then
12    [ -x /usr/bin/mplayer ] && PLAYER="mplayer"
13    [ -x /usr/bin/ogg123 ]  && PLAYER="ogg123"
14 fi
15
16 if ! [ $(which $PLAYER) ] ; then
17    echo "Sorry, neither mplayer nor ogg123 available and \$PLAYER is not set.">&2
18    exit 1
19 fi
20
21 if [ -z "$1" ] ; then
22    FILE="/usr/share/grml/effect.ogg"
23 else
24    FILE="$*"
25 fi
26
27 if ! [ -r "$FILE" ] ; then
28    echo "Sorry, /usr/share/grml/effect.ogg of package grml-files not available.">&2
29    exit 1
30 fi
31
32 echo "$PN - trying to play $FILE with $PLAYER
33
34 You do not hear anything? Make sure volume is not turned off.
35 Adjust mixer settings via aumix or alsamixer.
36
37 Tip: $PN supports some options.
38 Just provide the file(s) you want to play as argument(s),
39 adjust player which should be used for playing the files
40 via environment variable PLAYER. Usage example:
41
42   PLAYER=mplayer $PN /usr/share/grml/effect.ogg /another/file/to/play.mp3
43 "
44
45 $PLAYER $FILE && echo "It looks like sound works for you. :-)" || echo "problems with sound? :-("
46
47 ## END OF FILE #################################################################