blob: 9dd1f832267ae510a9eebf631ff4db0ae7947c32 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# Define the lines to be added or removed
LANG_LINE='GenericLanguage "de" "de_DE" "utf-8"'
VOICE_LINE='AddVoice "de" "MALE1" "de/de_DE/thorsten/medium/de_DE-thorsten-medium"'
post_install() {
# Check if the piper-generic.conf file exists
if [ -f /etc/speech-dispatcher/modules/piper-generic.conf ]; then
# Add the lines only if they do not already exist
if ! grep -Fxq "$LANG_LINE" /etc/speech-dispatcher/modules/piper-generic.conf; then
echo "$LANG_LINE" >> /etc/speech-dispatcher/modules/piper-generic.conf
fi
if ! grep -Fxq "$VOICE_LINE" /etc/speech-dispatcher/modules/piper-generic.conf; then
echo "$VOICE_LINE" >> /etc/speech-dispatcher/modules/piper-generic.conf
fi
fi
}
post_remove() {
# Check if the piper-generic.conf file exists
if [ -f /etc/speech-dispatcher/modules/piper-generic.conf ]; then
# Remove the lines if they exist
sed -i "/^$LANG_LINE$/d" /etc/speech-dispatcher/modules/piper-generic.conf
sed -i "/^$VOICE_LINE$/d" /etc/speech-dispatcher/modules/piper-generic.conf
fi
}
|