-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·62 lines (53 loc) · 1.98 KB
/
install.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
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
info() {
echo -e "[$(date '+%H:%M:%S')]\033[32m[INFO]\033[0m ${@}"
}
error() {
echo -e "[$(date '+%H:%M:%S')]\033[31m[ERROR]\033[0m ${@}"
}
warning() {
echo -e "[$(date '+%H:%M:%S')]\033[33m[WARNING]\033[0m ${@}"
}
install_apt_packages() {
# Install all packages from VoiceCraft README: https://github.com/jasonppy/VoiceCraft
info "Installing apt packages..."
sudo apt-get update
sudo apt-get install -y git
sudo apt-get install -y ffmpeg
sudo apt-get install -y espeak-ng
sudo apt-get install -y espeak espeak-data libespeak1 libespeak-dev
sudo apt-get install -y festival*
sudo apt-get install -y build-essential
sudo apt-get install -y flac libasound2-dev libsndfile1-dev vorbis-tools
sudo apt-get install -y libxml2-dev libxslt-dev zlib1g-dev
}
create_voicecraftapi_user() {
if ! id voicecraftapi >/dev/null 2>&1; then
info "Creating voicecraftapi user."
sudo useradd -r -U -m -d /usr/share/voicecraftapi voicecraftapi
fi
}
configure_systemd() {
info "Creating systemd service."
sudo cp /usr/share/voicecraftapi/VoiceCraftAPI/voicecraft-api.service /etc/systemd/system/voicecraft-api.service
sudo systemctl daemon-reload
sudo systemctl enable --now voicecraft-api.service
}
info "Please input your password so that the script can use sudo to configure."
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
install_apt_packages
create_voicecraftapi_user
# Login as user
sudo -i -u voicecraftapi /bin/bash << EOF
cd ~/
if [ -d "$(basename https://github.com/CalvesGEH/VoiceCraftAPI .git)" ]; then
echo "Directory exists, pulling latest changes..."
cd $(basename https://github.com/CalvesGEH/VoiceCraftAPI .git) && git pull origin master
else
echo "Cloning repository..."
git clone https://github.com/CalvesGEH/VoiceCraftAPI && cd $(basename https://github.com/CalvesGEH/VoiceCraftAPI .git)
fi
./install_voicecraftapi.sh --skip-apt
EOF
configure_systemd