This repository has been archived by the owner on Aug 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
postupdate.sh
executable file
·51 lines (49 loc) · 1.6 KB
/
postupdate.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
if [[ -f /usr/bin/apt ]]; then
apt install -y libasound2-dev
fi
if [[ ! -d /root/.vosk ]]; then
origDir=$(pwd)
echo "Getting VOSK assets"
rm -fr /root/.vosk
mkdir /root/.vosk
cd /root/.vosk
if [[ ${ARCH} == "x86_64" ]]; then
VOSK_DIR="vosk-linux-x86_64-0.3.43"
elif [[ ${ARCH} == "aarch64" ]]; then
VOSK_DIR="vosk-linux-aarch64-0.3.43"
elif [[ ${ARCH} == "armv7l" ]]; then
VOSK_DIR="vosk-linux-armv7l-0.3.43"
fi
VOSK_ARCHIVE="$VOSK_DIR.zip"
wget -q --show-progress "https://github.com/alphacep/vosk-api/releases/download/v0.3.43/$VOSK_ARCHIVE"
unzip "$VOSK_ARCHIVE"
mv "$VOSK_DIR" libvosk
rm -fr "$VOSK_ARCHIVE"
cd ${origDir}/chipper
export CGO_ENABLED=1
export CGO_CFLAGS="-I/root/.vosk/libvosk"
export CGO_LDFLAGS="-L /root/.vosk/libvosk -lvosk -ldl -lpthread"
export LD_LIBRARY_PATH="/root/.vosk/libvosk:$LD_LIBRARY_PATH"
/usr/local/go/bin/go get -u github.com/alphacep/vosk-api/go/...
/usr/local/go/bin/go get github.com/alphacep/vosk-api
/usr/local/go/bin/go install github.com/alphacep/vosk-api/go
cd ${origDir}
rm -fr vosk
mkdir -p vosk
mkdir -p vosk/models
echo "Downloading English (US) model"
mkdir -p vosk/models/en-US
cd vosk/models/en-US
wget https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
mv vosk-model-small-en-us-0.15 model
rm vosk-model-small-en-us-0.15.zip
cd ${origDir}
cd ${origDir}/vosk
touch completed
echo
cd ..
else
echo "postupdate - Nothing to be done!"
fi