Scripts to share

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

a thread mentioning speakupconf made me think that maybe the attached
scripts, shipped in Slint, could be useful to others, if not as is after
adaptations to other contexts.

speakup-save and speakup-restore allow to save/restore the speakup
settings specifically for the screen reader in use: speechd-up or
espeakup, or the hard synthesizer in use.

in Slint speakup-save is run as root by the user, speakup-restore is run
by the daemon managers of espeakup and speechd-up, which in case of a
hard synthesizer just configure speakup instead of starting a daemon at
startup.

speakup-restore is also run indirectly by speak-with, loosely similar to
talkwith but which also supports fenrir.

All these scripts are attached and I put them in the public domain, so
do what you want with them.

Bug reports are welcome.

Putting this stuff in a Git repository is in my TODO list, but not on top.

Cheers,

Didier
#!/bin/sh
ESPEAKUP=/usr/bin/espeakup

### Code snippet common to rc.espeakup and rc-speechd-up. ###
hardlist=$(zgrep SPEAKUP_S /proc/config.gz|grep [ym]|grep -v DUMMY| \
sed 's/CONFIG_SPEAKUP_SYNTH_//;s/..$//'|tr '[:upper:]' '[:lower:]'|sed s/soft// )
# A hardware synthesizer can be set either in the boot command line or
# in the configuration file /etc/speakup.conf. In both cases we won't
# start espeakup or speechd-up that rely on a soft synthesizer, but we
# restore the speakup settings.
if grep -q speakup /proc/cmdline; then
	HARDCMDLINE=$(sed "s/.*speakup.synth=\([[:alpha:]]\{1,\}\).*/\1/" /proc/cmdline)
fi
if [ -f /etc/speakup.conf ]; then
	. /etc/speakup.conf
	HARDCONF=$hard
fi
# We give priority to the settings in /etc/espeakup.conf over those on
# the command line. "hard=none" in the former indicates that the user
# chose not to use a hard synthesizer. This way the user does not need 
# to edit the command line to modify a setting, like using another hard
# synthesizer or use on a soft synthesizer instead of a hard one.
if [ ! "$HARDCONF" =  "none" ]; then
	if [ ! "$HARDCONF" = "" ]; then
	# The user ran speak-with and chose a hard synth
		modprobe speakup_$HARDCONF 2>/dev/null
		echo $HARDCONF > /sys/accessibility/speakup/synth
		[ -x /usr/sbin/speakup-restore ] && speakup-restore
		exit
	elif [ ! "$HARDCMDLINE" = "" ] && grep -q $HARDCMDLINE $hardlist ]; then
		# The user has not run speak-with to choose a hard synth but
		# has indicated one in the boot command line
		modprobe speakup_$HARDCMDLINE 2>/dev/null
		echo $HARDCMDLINE > /sys/accessibility/speakup/synth
		[ -x /usr/sbin/speakup-restore ] && speakup-restore
		exit
	fi
fi
# We didn't exit yet, so we will manage the daemon of the soft synth. 
# modprobe won't complain even if the driver is built-in. Else the
# "echo" command is not necessary but won't hurt. 
modprobe speakup_soft 2>/dev/null
echo "soft" > /sys/accessibility/speakup/synth
sleep 1

chmod 666 /sys/accessibility/speakup/soft/*
echo 1 > /sys/accessibility/speakup/soft/direct
### End of the code snippet common to rc.espeakup and rc.speechd-up ###

if [ "$LANG" = "" ]; then
. /etc/profile.d/lang.sh
fi

# Starts/stops/restart espeakup
set_voice_from_lang () {
	lang=`echo $LANG | sed 's/_.*//'`
	country=`echo $LANG | sed 's/.*_//;s/\..*//;s/@.*//' | tr A-Z a-z`
	if [ "$lang" = gl ]; then
		# Not supported by espeak-ng yet, but pt should be fine enough, better
		# than English anyway
		# Comment above from Debian. We don't propose gv in Slint yet, but
		# maybe later ?
		lang=pt
	fi
	# Setup a table lang => associated voice file name
	# We will start espeakup with a voice file name as argument of the
	# -V option, as if we give a  $lang-$country argument that does
	# not match a voice file name it segfault when we switch from a
	# graphical environment with Orca running to a console.

	VOICESTABLE=$(espeak-ng --voices|sed "s;[ ]\{1,\};,;g"|cut -d, -f3-6|cut -d, --complement -f2-3|sed "s;,.*/;,;")
	if [ ! "$(echo "$VOICESTABLE"|grep "^$lang-$country")" = "" ]; then
		VOICE=$(echo "$VOICESTABLE"|grep "^${lang}-${country},"|cut -d, -f2)
	elif [ ! "$(echo "$VOICESTABLE"|grep "^$lang,")" = "" ]; then
		VOICE="$lang"
	else
		VOICE=en
	fi
	echo $VOICE > /tmp/voice_from_lang
}
set_voice_from_lang
VOICEFROMLANG=$(cat /tmp/voice_from_lang)
rm /tmp/voice_from_lang
set_voice_from_config () {
	# We will first try to match the voice set in the config file with
	# an mbrola voice. In that aim we make a table of mbrola voices file
	# names with the associated mbrola voice installed.  
	MBROLAVOICES=$(espeak-ng --voices=mb|sed "s, ,,;s;[ ]\{1,\};,;g"|cut -d, -f5|sed s,mb/,,)
	for i in $(echo "$MBROLAVOICES"|sed "s/mb-//g;s/-.*//"|sort|uniq); do
		if [ "$(ls /usr/share/mbrola|grep $i)" = "" ]; then
			MBROLAVOICES=$(echo "$MBROLAVOICES"|grep -v $i)
		fi
	done
	VOICESTABLE=$(espeak-ng --voices|sed "s;[ ]\{1,\};,;g"|cut -d, -f3-6|cut -d, --complement -f2-3|sed "s;,.*/;,;")
	lang=$(echo $voice|sed "s/-.*//")
	if [ ! "$(echo "$MBROLAVOICES"|grep $voice)" = "" ]; then
		VOICE=$voice
	elif [ ! "$(echo "$VOICESTABLE"|grep "${voice},")" = "" ]; then
		VOICE=$(echo "$VOICESTABLE"|grep "${voice},"|cut -d, -f2)
	elif [ ! "$(echo "$VOICESTABLE"|grep "^$lang")" = "" ]; then
		VOICE="$lang"
	else
		VOICE=en
	fi
	echo $VOICE > /tmp/voice_from_config
}

espeakup_start() {
	[ "$LANG" = "" ] && . /etc/profile.d/lang.sh
	if [ -f /etc/espeakup.conf ]; then
		. /etc/espeakup.conf
		if [ "$voice" = "" ]; then
			voice=$VOICEFROMLANG
		else
			set_voice_from_config
			VOICEFROMCONFIG=$(cat /tmp/voice_from_config)
			rm /tmp/voice_from_config
			voice=$VOICEFROMCONFIG
		fi
	fi
	if [ ! "`ps -C espeakup --noheaders|wc -l`" = "0" ]; then
		echo "espeakup is already started."
		espeakup_status
		exit
	fi
	if [ -x $ESPEAKUP ]; then
		CARDS=$(mktemp)
		for i in /sys/class/sound/card*; do
			printf $i|sed "s/.*card//";printf " ";cat $i/id
		done > $CARDS
		NUMBEROFCARDS=$(find /sys/class/sound -name "card*"|wc -l)
		if [ $NUMBEROFCARDS -gt 1 ]; then
			echo "$NUMBEROFCARDS sound cards have been found:"
			cat $CARDS
			if [ "$ALSA_CARD" = "" ]; then
				echo "ALSA_CARD not set in /etc/espeakup.conf, using the default."
			elif ! grep -wq $ALSA_CARD $CARDS; then
				echo "Card $ALSA_CARD set in /etc/espeakup not found, using the default."
				ALSA_CARD=""
			fi
		fi
		V=$(grep ^voice= /etc/espeakup.conf|sed s/voice=//)
		if [ ! "$V" = "" ] && [ ! "$V" = "$voice" ]; then
			echo "Voice set to $V in /etc/espeakup.conf, using $voice for espeakup."
		elif [ "$V" = "" ]; then
			echo "Voice not set in /etc/espeakup.conf, LANG=$LANG, using $voice for espeakup."
		fi
		if [ "$ALSA_CARD" = "" ]; then
			echo "Starting espeakup with voice $voice"
			$ESPEAKUP -V $voice
		else
			echo "Starting espeakup with voice $voice using sound card $ALSA_CARD"
			ALSA_CARD=$ALSA_CARD $ESPEAKUP -V $voice
		fi
	    [ -x /usr/sbin/speakup-restore ] && speakup-restore
        rm $CARDS
	else
		echo "$ESPEAKUP not found or non executable"
	fi
}

espeakup_stop() {
  NBPROC="`ps -C espeakup --noheaders|wc -l`"
  if [ ! "$NBPROC" = "0" ]; then
    sleep 1
    PID="`ps -C espeakup --noheaders -o pid`"
    kill -s 9 $PID
  fi
}

espeakup_restart() {
    espeakup_stop
    sleep 2
    espeakup_start
}

espeakup_status() {
  NBPROC="`ps -C espeakup --noheaders|wc -l`"
  if [ "$NBPROC" = "0" ]; then
    echo "espeakup is not started" 
  elif [ "$NBPROC" = "1" ]; then
    echo "An espeakup daemon is running, PID: `ps -C espeakup --no-headers -o pid`"
  else
    ps -C espeakup -o pid,args
  fi
}

case "$1" in
    start)
	    espeakup_start;;
    stop)
		espeakup_stop;;
    restart)
		espeakup_restart;;
    status)
		espeakup_status;;
    *)
        echo "Usage: $0 {start|stop|restart|status}";;
esac
#!/bin/sh
SPEECHD=/usr/bin/speechd-up
### Code snippet common to rc.espeakup and rc-speechd-up. ###
hardlist=$(zgrep SPEAKUP_S /proc/config.gz|grep [ym]|grep -v DUMMY| \
sed 's/CONFIG_SPEAKUP_SYNTH_//;s/..$//'|tr '[:upper:]' '[:lower:]')
# A hardware synthesizer can be set either in the boot command line or
# in the configuration file /etc/speakup.conf. In both cases we won't
# start espeakup or speechd-up that rely on a soft synthsizer, but we
# restore the speakup settings. 
if grep -q speakup /proc/cmdline; then
	HARDCMDLINE=$(sed "s/.*speakup.synth=\([[:alpha:]]\{1,\}\).*/\1/" /proc/cmdline)
fi
if [ -f /etc/speakup.conf ]; then
	. /etc/speakup.conf
	HARDCONF=$hard
fi
# We give priority to the settings in /etc/espeakup.conf over those on
# the command line. "hard=none" in the former indicates that the user
# chose not to use a hard synthesizer. This way the user does not need 
# to edit the command line to modify a setting, like using another hard
# synthesizer or use on a soft synthesizer instead of a hard one.
if [ ! "$HARDCONF" =  "none" ]; then
	if [ ! "$HARDCONF" = "" ] ; then
	# The user ran speak-with and chosen a hard synth
		modprobe speakup_$HARDCONF 2>/dev/null
		echo $HARDCONF > /sys/accessibility/speakup/synth
		[ -x /usr/sbin/speakup-restore ] && speakup-restore
		exit
  
	elif [ ! "$HARDCMDLINE" = "" ] && grep -q $HARDCMDLINE $hardlist ]; then
		# The user has not run speak-with to choose a hard synth but
		# has indicated one in the boot command line
		modprobe speakup_$HARDCMDLINE 2>/dev/null
		echo $HARDCMDLINE > /sys/accessibility/speakup/synth
		[ -x /usr/sbin/speakup-restore ] && speakup-restore
		exit
	fi
fi
# We didn't exit yet, so we will manage the daemon of the soft synth. 
# modprobe won't complain even if the driver is built-in. Else the
# "echo" command is not necessary but won't hurt. 
modprobe speakup_soft 2>/dev/null
echo "soft" > /sys/accessibility/speakup/synth
sleep 1

chmod 666 /sys/accessibility/speakup/soft/*
echo 1 > /sys/accessibility/speakup/soft/direct
### End of the code snippet common to rc.espeakup and rc.speechd-up ###
# Starts/stops/restart speechd-up
speechd_up_start() {
  if [ -f /etc/speechd-up.conf ]; then
        . /etc/speechd-up.conf 2>/dev/null
  fi
  if [ ! "`ps -C speechd-up --noheaders|wc -l`" = "0" ]; then
      echo "speechd-up is already started."
      speechd_up_status
      exit
  fi
  if [ -x $SPEECHD ]; then
		echo "Starting speechd-up"
		sleep 2
		if [ ! "$ALSA_CARD" = "" ] && [ "$(echo $ALSA_CARD|sed 's/[[:digit:]]//g')" = "" ]; then
			( export ALSA_CARD=$ALSA_CARD
			$SPEECHD -d 1>/dev/null 2>/dev/null
			)
		else
			$SPEECHD -d 1>/dev/null 2>/dev/null
		fi
		[ -x /usr/sbin/speakup-restore ] && speakup-restore
	else
		echo "$SPEECHD not found or non executable."
	fi
}
speechd_up_stop() {
  NBPROC="`ps -C speechd-up --noheaders|wc -l`"
  if [ ! "$NBPROC" = "0" ]; then
    echo "Stopping speechd-up..."
    PID="`ps -C speechd-up --noheaders -o pid`"
    kill $PID
  else
    echo "speechd-up is not running."
   fi
}

speechd_up_restart() {
    speechd_up_stop
    sleep 5
    speechd_up_start
}

speechd_up_status() {
  NBPROC="`ps -C speechd-up --noheaders|wc -l`"
  if [ "$NBPROC" = "0" ]; then
    echo "speechd-up is not running" 
  elif [ "$NBPROC" = "1" ]; then
    echo "A speechd-up daemon is running, PID: `ps -C speechd-up --no-headers -o pid`"
  else
    ps -C speechd-up -o pid,args
  fi
}

case "$1" in
    start)
	    speechd_up_start;;
    stop)
		speechd_up_stop;;
    restart)
		speechd_up_restart;;
    status)
		speechd_up_status;;
    *)
        echo "Usage: $0 {start|stop|restart|status}";;
esac

#!/bin/sh
if [ ! $(id -u) -eq 0 ]; then
	echo "Please run this script as root."
	exit
fi

if [ ! -f /sys/accessibility/speakup/synth ]; then
	echo "speakup being not in use, there is no setting to save."
	exit
elif [ "$(</sys/accessibility/speakup/synth)" = "none" ]; then
	echo "speakup being not in use, there is no setting to save."
	exit
fi

SYNTH=$(</sys/accessibility/speakup/synth)
ESPEAKUP=$(ps -C espeakup --noheaders|wc -l)
SPEECHD_UP=$(ps -C speechd-up --noheaders|wc -l)
# We saved settings separately for:
# espeakup
# each hard synthesizer
# speechd-up
# so that we restore the relevant settings for the synthesizer and
# screen reader in use.

SAVEDSYNTH="$SYNTH"
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -ne 0 ]; then
	SAVEDSYNTH="espeakup"
fi
if [ "$SYNTH" = "soft" ] && [ $SPEECHD_UP -ne 0 ]; then
	SAVEDSYNTH="speechd-up"
fi
# If SYNTH has not been set to speechd-up or speakup a hard synth is
# in use, like e.g. SAVEDSYNTH=apollo
if [ ! -d /var/lib/speakup/$SAVEDSYNTH ]; then
	echo "No speakup settings saved for $SAVEDSYNTH, so nothing to restore."
	exit
fi
cd /var/lib/speakup/$SAVEDSYNTH
ls|while read $i; do
	if [ -w /sys/accessibility/speakup/$i ] && [ -f /sys/accessibility/speakup/$i ]; then
		cp $i /sys/accessibility/speakup/
	fi
done
if [ -d i18n ] && [ -d /sys/accessibility/speakup/i18n ]; then
	( cd i18n
	ls|while read i; do
		if [ -w /sys/accessibility/speakup/i18n/$i ]; then
			cp $i /sys/accessibility/speakup/i18n/
		fi
	done
	)
fi
( cd $SYNTH
ls|while read i; do
	if [ -w /sys/accessibility/speakup/$SYNTH/$i ]; then
			cp $i /sys/accessibility/speakup/$SYNTH/
		fi
	done
	)
echo "speakup settings have been restored for $SAVEDSYNTH."
	

#!/bin/sh
if [ ! $(id -u) -eq 0 ]; then
	gettext -s "Please run this script as root."
	exit
fi
if [ ! -f /sys/accessibility/speakup/synth ]; then
	 "speakup being not in use, there is no setting to save."
	exit
fi
SYNTH=$(</sys/accessibility/speakup/synth)

if [ "$SYNTH" = "none" ]; then
	echo "speakup being not in use, there is no setting to save."
	exit
fi
ESPEAKUP=$(ps -C espeakup --noheaders|wc -l)
SPEECHD_UP=$(ps -C speechd-up --noheaders|wc -l)
# We save settings separately for:
# espeakup
# each hard synthesizer
# speechd-up
# so that we restore the relevant settings for the synthesizer and
# case occurring the screen reader in use.
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -ne 0 ] && [ $SPEECHD_UP -ne 0 ]; then
	gettext -s "espeakup and speechd-up are both running, not saving settings."
	exit
fi
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -eq 0 ] && [ $SPEECHD_UP -eq 0 ]; then
	gettext -s "neither espeakup nor speechd-up is running, not saving settings."
	exit
fi
if [ "$SYNTH" = "soft" ] && [ $ESPEAKUP -ne 0 ]; then
	SYNTH="espeakup"
fi
if [ "$SYNTH" = "soft" ] && [ $SPEECHD_UP -ne 0 ]; then
	SYNTH="speechd-up"
fi
# If SYNTH has not been set to speechd-up or speakup it is the hard synth
# in use.
mkdir -p /var/lib/speakup/$SYNTH	
cd /sys/accessibility/speakup
for i in $(find . -type d|sed "/^.$/d;s/..//"); do
	mkdir -p /var/lib/speakup/$SYNTH/$i
done
for i in $(find . -type f|sed "s/..//"|grep -v -e silent -e version -e "synth.*"); do
	if [ -f $i ] && [ -w $i ]; then
		cp $i /var/lib/speakup/$SYNTH/$i
	fi
done
gettext "Current speakup settings have been saved in "
echo "/var/lib/speakup/$SYNTH."
#!/bin/sh
# Didier Spaier <didier~at~slint.fr> 2019
# I wrote this script from scratch and put it in the public domain.
# I assume that the packages espeakup and speechd-up are installed.
# If fenrir is installed, it can also be used.
if [ ! $(id -u) -eq 0 ]; then
	echo "Please run this script as root."
	exit
fi
speakup="  a hard synthesizer (type its name, like \"apollo\" or \"acntsa\")"
if [ -x /usr/bin/espeakup ]; then
	espeakup="  espeakup (Console screen reader connecting espeak-ng and speakup)\n"
	n1="espeakup"
fi
if [ -x /usr/bin/speechd-up ]; then
	speechd_up="  speechd-up (Console screen reader connecting Speech Dispatcher and speakup)"
	n2="speechd-up"
fi
if [ -x /usr/bin/fenrir ]; then
	fenrir="  fenrir (Modular, flexible and fast console screen reader)\n"
	n3="fenrir"
fi
readers="$espeakup$fenrir$speechd_up"
hardlist="$(zgrep SPEAKUP_S /proc/config.gz|grep [ym]|grep -v DUMMY| \
sed 's/CONFIG_SPEAKUP_SYNTH_//;s/..$//'|tr '[:upper:]' '[:lower:]')"
usage() {
  echo "Usage: $0 <screen reader> or <hard synthesizer> or none"
  echo "Choose a console screen reader to talk with among:" 
  echo -e "$readers"
  echo "or use one of the supported hard synthesizers:"
  echo "  "$hardlist
  echo "or type  \"$0 none\" to mute all screen readers." 
  exit
}
to_lower() {
echo "$1"|tr '[:upper:]' '[:lower:]'
}
ARGUMENT=$(to_lower $1)
if [ $# -ne 1 ]; then usage; fi
if [ ! "$ARGUMENT" = "$n1" ] && \
   [ ! "$ARGUMENT" = "$n2" ] && \
   [ ! "$ARGUMENT" = "$n3" ] && \
   ! echo $hardlist| grep -qw $ARGUMENT && \
   [ ! "$ARGUMENT" = "none" ]; then
	echo "$1 is not a valid argument of this command."
	usage
	exit
fi
# We first check which console screen reader is already running, if any.
if [ ! "$(ps -C fenrir --noheaders|wc -l)" = "0" ]; then
	FENRIR=y
fi
if [ -f /sys/accessibility/speakup/synth ]; then
	SPKSYNTH=$(cat /sys/accessibility/speakup/synth)
	if [ "$SPKSYNTH" = "soft" ]; then 
		if [ ! "$(ps -C speechd-up --noheaders|wc -l)" = "0" ]; then
			SPEECHDUP="y"
		fi
		if [ ! "$(ps -C espeakup --noheaders|wc -l)" = "0" ]; then
			ESPEAKUP="y"
		fi
	else
	HARD=$SPKSYNTH
	fi
fi
# If a hard synth is in use store its name as we need to override it to
# use a soft synth instead if wished, but we need to restore it if the
# user does not want a permanent change.
if [ -f /etc/speakup.conf ]; then
	. /etc/speakup.conf
fi
case $ARGUMENT in
	espeakup)
		if [ ! -x /usr/bin/espeakup ]; then 
			echo "espeakup is not installed."
			exit
		fi
		if [ "$ESPEAKUP" = "y" ]; then
			echo "$1 is already started."
			exit
		fi
		if [ "$FENRIR" = "y" ]; then
			[ -f /etc/rc.d/rc.fenrir ] && sh /etc/rc.d/rc.fenrir stop
		fi
		if [ "$SPEECHDUP" = "y" ]; then
			sh /etc/rc.d/rc.speechd-up stop
		fi
		echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
		echo "hard=none" >> /etc/speakup.conf
		sh /etc/rc.d/rc.espeakup start
		sleep 1
		printf "Should espeakup be also started at next boot? [Y/n] "
		read ANSWER
		if [ ! "$(to_lower $ANSWER)" = "n" ]; then
			chmod 755 /etc/rc.d/rc.espeakup
			chmod 644 /etc/rc.d/rc.speechd-up
			[ -f /etc/rc.d/rc.fenrir ] && chmod 644 /etc/rc.d/rc.fenrir
			echo "Done."
		elif [ ! "$hard" = "" ]; then
			echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
			echo hard=$hard >> /etc/speakup.conf
		fi
	;;
	speechd-up)
		if [ ! -x /usr/bin/speechd-up ]; then
			echo "speechd-up is not installed."
			exit
		fi
		if [ "$SPEECHDUP" = "y" ]; then
			echo "speechd-up is already started."
			exit
		fi
		if [ "$FENRIR" = "y" ]; then
			sh /etc/rc.d/rc.fenrir stop
		fi
		if [ "$ESPEAKUP" = "y" ]; then
			sh /etc/rc.d/rc.espeakup stop
		fi
		echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
		echo "hard=none" >> /etc/speakup.conf
		sh /etc/rc.d/rc.speechd-up start
		sleep 1
		printf "Should speechd-up be also started at next boot? [Y/n] "
		read ANSWER
		if [ ! "$(to_lower $ANSWER)" = "n" ]; then
			chmod 644 /etc/rc.d/rc.espeakup
			[ -f /etc/rc.d/rc.fenrir ] && chmod 644 /etc/rc.d/rc.fenrir
			chmod 755 /etc/rc.d/rc.speechd-up
			echo "Done."
		elif [ ! "$hard" = "" ]; then
			echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
			echo hard=$hard >> /etc/speakup.conf
		fi
	;;
	fenrir)
		if [ ! -x /usr/bin/fenrir ]; then
			echo "fenrir is not installed."
			exit
		fi
		if [ "$FENRIR" = "y" ]; then
			echo "fenrir is already started."
			exit
		fi
		if [ "$SPEECHDUP" = "y" ]; then
			sh /etc/rc.d/rc.speechd-up stop
		fi
		if [ "$ESPEAKUP" = "y" ]; then
			sh /etc/rc.d/rc.espeakup stop
		fi
		if [ ! "$SPKSYNTH" = "" ]; then
			echo none > /sys/accessibility/speakup/synth
		fi
		echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
		echo "hard=none" >> /etc/speakup.conf
		sh /etc/rc.d/rc.fenrir start
		sleep 1
		clear
		printf "Should fenrir be also started at boot time? [Y/n] "
		read ANSWER
		if [ ! "$(to_lower $ANSWER)" = "n" ]; then 
			chmod 644 /etc/rc.d/rc.espeakup
			chmod 644 /etc/rc.d/rc.speechd-up
			chmod 755 /etc/rc.d/rc.fenrir
			echo "Done."
		elif [ ! "$hard" = "" ]; then
			echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
			echo hard=$hard >> /etc/speakup.conf
		fi
	;;
	none)
		if [ "$FENRIR" = "y" ]; then
			sh /etc/rc.d/rc.fenrir stop
		fi
		if [ "$ESPEAKUP" = "y" ]; then
			sh /etc/rc.d/rc.espeakup stop
		fi
		if [ "$SPEECHDUP" = "y" ]; then
			sh /etc/rc.d/rc.speechd-up stop
		fi
		if [ ! "$SPKSYNTH" = "" ]; then
			echo none > /sys/accessibility/speakup/synth
		fi
		printf "Do you also want a mute console at next boot? [Y/n] "
		read ANSWER
		if [ ! "$(to_lower $ANSWER)" = "n" ]; then
			chmod 644 /etc/rc.d/rc.espeakup
			chmod 644 /etc/rc.d/rc.speechd-up
			[ -f /etc/rc.d/rc.fenrir ] && chmod 644 /etc/rc.d/rc.fenrir
			echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
			echo "hard=none" >> /etc/speakup.conf
			echo "OK"
		fi
	;;
	*)
		if [ "$FENRIR" = "y" ]; then
			sh /etc/rc.d/rc.fenrir stop
		fi
		if [ "$ESPEAKUP" = "y" ]; then
			sh /etc/rc.d/rc.espeakup stop
		fi
		if [ "$SPEECHDUP" = "y" ]; then
			sh /etc/rc.d/rc.speechd-up stop
		fi
		modprobe speakup_$ARGUMENT 2>/dev/null
		echo $ARGUMENT  > /sys/accessibility/speakup/synth
		if [ $? != 0 ]; then
			echo "Unable to switch to the $ARGUMENT synthesizer."
			echo "Something should be wrong."
			exit 1
		fi
		printf "Should $ARGUMENT be also used at next boot? [Y/n] "
		read ANSWER
		if [ ! "$(to_lower $ANSWER)" = "n" ]; then
			chmod 644 /etc/rc.d/rc.speechd-up
			[ -f /etc/rc.d/rc.fenrir ] && chmod 644 /etc/rc.d/rc.fenrir
			chmod 755 /etc/rc.d/rc.espeakup
			echo "# File written by speak-with. Do not edit." > /etc/speakup.conf
			echo "hard=$ARGUMENT" >> /etc/speakup.conf
			echo "Done."
		fi
esac
_______________________________________________
Speakup mailing list
Speakup@xxxxxxxxxxxxxxxxx
http://linux-speakup.org/cgi-bin/mailman/listinfo/speakup

[Index of Archives]     [Linux for the Blind]     [Fedora Discussioin]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]

  Powered by Linux