X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=blobdiff_plain;f=autoconfig.functions;h=936a94a6035fdd8c08d9b0850531bd9f3a6ee4fb;hp=ea88da17fc163725a7e73d90f9b6cb7b7594afae;hb=554cf6e7175743a8fe3d9d938e7d9899056fa9a8;hpb=8328ba1e87429b4bdff9c7a686ea39c5c6a0d048 diff --git a/autoconfig.functions b/autoconfig.functions index ea88da1..936a94a 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -76,6 +76,11 @@ checkgrmlsmall(){ checkgrmlusb(){ grep -q usb /etc/grml_version 2>>$DEBUG && return 0 || return 1 } + +# execute flite only if it's present +flitewrapper() { + [ -x /usr/bin/flite ] && flite -o play -t "$*" +} ### }}} # {{{ filesystems (proc, pts, sys) and fixes @@ -821,21 +826,21 @@ config_swspeak(){ if checkbootparam swspeak ; then einfo "Bootoption swspeak found." - if ! [ -d /proc/speakup/ ] ; then - ewarn" Kernel does not support software speakup - trying to load kernel module:" ; eend 0 + if [ ! -d /proc/speakup/ ] && ! grep -q speakup /proc/modules ; then + ewarn "Kernel does not support software speakup - trying to load kernel module:" ; eend 0 eindent einfo "Loading speakup_soft" if modprobe speakup_soft ; then eend 0 else - flite -o play -t "Fatal error setting up software speakup" + flitewrapper "Fatal error setting up software speakup" eend 1 return 1 fi eoutdent fi - if [ -d /proc/speakup/ ] ; then + if [ -d /proc/speakup/ ] || grep -q speakup /proc/modules ; then einfo "Kernel supports speakup." ; eend 0 eindent if [ -x /etc/init.d/speech-dispatcher ] ; then @@ -844,15 +849,15 @@ config_swspeak(){ einfo "Activating sftsyn in Kernel." echo sftsyn >/proc/speakup/synth_name ; eend $? einfo "Just run swspeak if you want to use software synthesizer via speakup." - flite -o play -t "Finished activating software speakup. Just run swspeak when booting finished." + flitewrapper "Finished activating software speakup. Just run swspeak when booting finished." else eerror "speech-dispatcher not available. swspeak will not work without it." ; eend 1 - flite -o play -t "speech-dispatcher not available. speakup will not work without it." + flitewrapper "speech-dispatcher not available. speakup will not work without it." fi eoutdent else eerror "Kernel does not seem to support speakup. Skipping swspeak." ; eend 1 - flite -o play -t "Kernel does not seem to support speakup. Sorry." + flitewrapper "Kernel does not seem to support speakup. Sorry." fi fi } @@ -863,7 +868,7 @@ config_hwspeak(){ if checkbootparam hwspeak ; then einfo "Bootoption hwspeak found." - if ! [ -d /proc/speakup/ ] ; then + if [ ! -d /proc/speakup/ ] && ! grep -q speakup /proc/modules ; then ewarn" Kernel does not support hardware speakup - trying to load kernel modules:" ; eend 0 eindent for module in $(find "/lib/modules/${KERNEL}/extra/speakup/" -name \*.ko | \ @@ -876,12 +881,12 @@ config_hwspeak(){ eoutdent fi - if [ -d /proc/speakup/ ] ; then - einfo "Kernel supports speakup now." ; eend 0 - flite -o play -t "Kernel supports speakup now." + if [ -d /proc/speakup/ ] || grep -q speakup /proc/modules ; then + einfo "Kernel should support speakup now." ; eend 0 + flitewrapper "Kernel should support speakup now." else eerror "Kernel or hardware do not seem to support speakup. Skipping hwspeak." ; eend 1 - flite -o play -t "Kernel or hardware do not seem to support speakup. Sorry." + flitewrapper "Kernel or hardware do not seem to support speakup. Sorry." fi fi } @@ -1771,7 +1776,7 @@ config_netconfig(){ config_blindsound(){ if checkbootparam "blind" ; then beep - flite -o play -t "welcome to the gremel system" + flitewrapper "welcome to the gremel system" fi } # }}} @@ -1779,7 +1784,7 @@ config_blindsound(){ # {{{ welcome sound config_welcome(){ if checkbootparam welcome ; then - flite -o play -t "welcome to the gremel system" + flitewrapper "welcome to the gremel system" fi } # }}}