summarylogtreecommitdiffstats
path: root/piper-voices-fr-fr.install
blob: a7d7e484f16bd031c2d52e68872a938fb4d6a58a (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   "fr" "fr_FR" "utf-8"'
VOICE_LINE='AddVoice "fr" "FEMALE1"    "fr/fr_FR/siwis/medium/fr_FR-siwis-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
}