--- /usr/bin/vvsetenv.orig	Thu Nov 23 12:42:43 2000
+++ /usr/bin/vvsetenv	Mon Nov  5 16:43:42 2001
@@ -1,3 +1,6 @@
+#!/bin/bash
+# Dear IBM: it's not very useful to have this line displaced from the top
+# of the file by a big copyright statement.
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -20,7 +23,6 @@
 #//     vvstartuserwizard: To start ViaVoice Userwizard
 #//
 #///////////////////////////////////////////////////////////////////////////////
-#!/bin/bash
 #-------------------------------------------------------------------------
 # Script to set all of the environment variables that the speech engine
 # is going to be using
@@ -47,11 +49,16 @@
   export SPCH_DIR=${HOME}/viavoice/temp/tmp
   export SPCH_UWIZ_LOC=/usr/lib/ViaVoice/UWiz
 
-
 #------------------------------------------
 # Setup Class Paths for Java
-# 
-#
+#------------------------------------------
 export CLASSPATH=/usr/lib/ViaVoice/bin/classes/userwizardApp.zip:/usr/lib/ViaVoice/bin/classes/userwizardComponents.zip:/usr/lib/ViaVoice/bin/classes/userwizardCtrls.zip:$CLASSPATH
 
-export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
+#------------------------------------------
+# Setup location of java used for ViaVoice
+#------------------------------------------
+export SPCH_JAVA=/usr/lib/jdk1.3/jre
+
+# This diddling with LD_LIBRARY_PATH is completely unnecessary.
+# /usr/lib does not contain any ViaVoice-related libraries.
+#export LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
--- /usr/bin/vvstartaudiosetup.orig	Thu Nov 23 12:42:44 2000
+++ /usr/bin/vvstartaudiosetup	Fri Dec  7 20:44:20 2001
@@ -1,3 +1,4 @@
+#!/bin/sh
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -123,7 +124,7 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/opt/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java com.ibm.speechapps.userwizard.UWizAudSet $1
 fi
 sleep 4
--- /usr/bin/vvstartdictation.orig	Fri Dec  1 11:03:09 2000
+++ /usr/bin/vvstartdictation	Mon Nov  5 16:37:16 2001
@@ -72,6 +72,6 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/usr/lib/ViaVoice/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java -jar speakpad.jar -gl $1
 exit 0
--- /usr/bin/vvstartenrollment.orig	Thu Nov 23 12:42:44 2000
+++ /usr/bin/vvstartenrollment	Fri Dec  7 20:44:11 2001
@@ -1,3 +1,4 @@
+#!/bin/sh
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -123,7 +124,7 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/opt/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java com.ibm.speechapps.userwizard.UWizJustEnr $1
 fi
 sleep 4
--- /usr/bin/vvstartuserguru.orig	Thu Nov 23 12:42:44 2000
+++ /usr/bin/vvstartuserguru	Mon Nov  5 16:37:16 2001
@@ -1,3 +1,4 @@
+#!/bin/sh
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -123,7 +124,7 @@
 #
 # USE IBM JAVA =)
 #
-export PATH=/opt/IBMJava2-13/jre/bin:$PATH
+export PATH=$SPCH_JAVA/bin:$PATH
 java com.ibm.speechapps.userwizard.UWiz $1
 fi
 sleep 4
--- /usr/lib/ViaVoice/bin/vvsetuser.orig	Thu Nov 23 12:42:43 2000
+++ /usr/lib/ViaVoice/bin/vvsetuser	Mon Dec 10 13:00:38 2001
@@ -1,3 +1,4 @@
+#!/bin/sh
 #///////////////////////////////////////////////////////////////////////////////
 #//===========================================================================//
 #// COPYRIGHT:                                                                //
@@ -149,5 +150,7 @@
 echo $USINGTASK $VVTASK;;
 esac
 $SPCH_BIN/vvuser -adduser ${USERNAME} -setdefault -usetask ${VVTASK}
-sleep 10 
-fi
\ No newline at end of file
+# We want to start viavoice, not stare at the screen for ages
+#sleep 10
+sleep 2
+fi
--- /dev/null	Sun Nov  4 16:03:49 2001
+++ /usr/bin/viavoice	Mon Dec 10 12:50:59 2001
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# /usr/bin/viavoice
+# Restore alsa mixer settings for ViaVoice and start dictation
+#
+# Volker Kuhlmann
+#   9, 10 Sep; 10 Dec 2001
+#
+
+f=
+if alsactl 2>/dev/null; then
+    if [ -r /etc/asound.conf.viavoice ]; then
+	echo "Restoring mixer settings from /etc/asound.conf.viavoice"
+	alsactl -f /etc/asound.conf.viavoice restore "$@"
+	f=1
+    fi
+    if [ -r $HOME/viavoice/alsa.conf ]; then
+	echo "Restoring mixer settings from $HOME/viavoice/alsa.conf"
+	alsactl -f $HOME/viavoice/alsa.conf restore "$@"
+	f=1
+    fi
+else
+    echo "Can't execute alsactl - unable to restore mixer settings."
+fi
+test -z "$f" && echo \
+"Can't find any mixer settings to restore, ViaVoice might not run too well."
+echo ""
+exec /usr/bin/vvstartdictation "$@"
--- /dev/null	Sun Nov  4 16:03:49 2001
+++ /usr/bin/vvuser	Mon Nov  5 16:37:16 2001
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Run the program of ViaVoice which deals with creating/deleteing ViaVoice
+# users and voice models. Make this a stand-alone prgram.
+# Volker Kuhlmann
+#   9 Sep 2001
+source vvsetenv
+exec /usr/lib/ViaVoice/bin/vvuser "$@"
