#!/bin/sh -e

. /usr/share/debconf/confmodule

db_get espeakup/voice
VOICE=$RET
[ -n "$VOICE" ] || exit 0
db_get espeakup/card
ALSA_CARD=$RET

apt-install espeakup alsa-utils || true

cp /usr/share/espeakup-udeb/espeakup.default /target/etc/default/espeakup
sed -i -e "s/^VOICE=.*/VOICE=$VOICE/" /target/etc/default/espeakup
[ -z "$ALSA_CARD" ] || sed -i -e "s/^# ALSA_CARD=.*/ALSA_CARD=\"`cat /sys/class/sound/card$ALSA_CARD/id`\"/" /target/etc/default/espeakup
