2 # Filename: swspeak-setup
3 # Purpose: script for activating software speak(up) features
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 or any later version.
7 ################################################################################
8 # Note: the script is used via swspeak() function in grml's zshrc so
9 # the prompt of zsh is set accordingly
10 # TODO: support disabling swspeakup again?
12 if [ -r /etc/grml/script-functions ] ; then
13 . /etc/grml/script-functions
15 echo "Failed to source /etc/grml/script-functions - exiting.">&2
19 if [ -r /etc/grml/lsb-functions ] ; then
20 . /etc/grml/lsb-functions
22 echo "Failed to source /etc/grml/lsb-functions - exiting.">&2
26 if [ "$1" = '-h' ] || [ "$1" == '--help' ] ; then
28 swspeak - script for activating software speak features
30 Usage: swspeak [-a] [-e|-s] [-f] [-h]
34 -e use espeakup (default, if available)
35 -s use speechd-up (fallback, if available)
36 -a do not execute aumix for setting mixer levels
37 -f disable flite sound output
38 -h display this help text
44 [ "$1" = '-a' ] && NOAUMIX=1
46 [ "$1" = '-e' ] && ESPEAK=1
48 [ "$1" = '-f' ] && NOFLITE=1
50 [ "$1" = '-s' ] && SPEECHD=1
54 # execute flite only if it's present
56 if [ -x /usr/bin/flite -a -z "$NOFLITE" ] ; then
62 if [ -x /usr/bin/aumix -a -z "$NOAUMIX" ] ; then
63 einfo "Setting mixer levels to 90"
64 aumix -w 90 -v 90 -p 90 -m 90
68 # check for software synthesizer support
69 if ! [ -r /dev/softsynth ] ; then
70 if [ ! -d /proc/speakup/ ] && ! grep -q speakup /proc/modules ; then
71 ewarn "Kernel does not support software speakup - trying to load kernel module:" ; eend 0
73 einfo "Loading speakup_soft"
74 if modprobe speakup_soft ; then
77 flitewrapper "Fatal error setting up software speakup"
85 # the kernel module takes some time until it can be accessed
88 # helper functions for espeakup and speechd-up
90 if [ -x /usr/bin/espeakup ] ; then
93 flitewrapper "espeakup not available, sorry."
99 if [ -x /usr/bin/speechd-up ] ; then
100 /etc/init.d/speech-dispatcher start
101 nice -n -20 speechd-up
103 flitewrapper "speechd-up not available, sorry."
108 # finally execute the according program:
109 if [ -n "$ESPEAK" ] ; then
110 espeak && exit 0 || exit 1
113 if [ -n "$SPEECHD" ] ; then
114 speechd && exit 0 || exit 1
117 if grep -q 'swspeak=espeak' /proc/cmdline ; then
118 ( espeak && exit 0 ) || ( speechd && exit 0 ) || exit 1
119 elif grep -q 'swspeak=speechd' /proc/cmdline ; then
120 ( speechd && exit 0 ) || ( espeak && exit 0 ) || exit 1
122 ( espeak && exit 0 ) || ( speechd && exit 0 ) || exit 1
125 ## END OF FILE #################################################################
126 # vim: ai tw=100 expandtab foldmethod=marker shiftwidth=3