Skip to main content
#!/bin/bash
#
# 1. Update the OS
# 2. Configure for USB audio
# 3. Install espeak and espeakup
# 4. Enable speakup_soft
#

if [ `whoami` != 'root' ]; then
	echo 'Script must be run as root'
	exit 1
fi

set -e

echo 'Running an update...'
apt-get -y update

# Set USB audio as the default and disable the BCM audio driver
echo 'Configuring USB audio as the default...'
sed -i 's|\(options snd-usb-audio index=-2\)|#\1|' /lib/modprobe.d/aliases.conf
	sed -i 's|\(dtparam=audio=on\)|#\1|' /boot/config.txt

# Add speakup_soft to modules loaded at boot time
echo 'Adding speakup_soft to /etc/modules...'
echo -e "\n\nspeakup_soft\n\n" >> /etc/modules

# Load speakup_soft for this session so the espeakup install starts espeakup
echo 'Load speakup_soft for this session...'
modprobe speakup_soft

# Install espeak and espeakup
echo 'Installing espeak and espeakup...'
apt-get install -yq espeak espeakup

exit 0