add setup script
This commit is contained in:
71
get-whishper.sh
Normal file
71
get-whishper.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if docker is installed
|
||||
if ! [ -x "$(command -v docker)" ]; then
|
||||
echo "Docker is not installed. Please install docker first."
|
||||
echo "Run official docker installation script? (y/n)"
|
||||
echo "----> Check out the script: https://get.docker.com"
|
||||
echo "----> I will run: 'curl -fsSL https://get.docker.com | sudo sh'"
|
||||
read answer
|
||||
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||
echo "Running official docker installation script"
|
||||
curl -fsSL https://get.docker.com | sudo sh
|
||||
else
|
||||
echo "Aborting installation"
|
||||
exit 1
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ask if user wants to get everything in the current directory or in a new directory
|
||||
echo "Do you want to set up everything in the current directory? (y/n)"
|
||||
read answer
|
||||
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||
echo "Setting up everything in the current directory"
|
||||
else
|
||||
echo "Enter the name of the directory where you want to set up everything: "
|
||||
read directory
|
||||
echo "----> Setting up everything in the $directory directory"
|
||||
mkdir $directory
|
||||
cd $directory
|
||||
fi
|
||||
|
||||
echo "Getting the docker-compose.yml file from Github"
|
||||
curl -o docker-compose.yml https://raw.githubusercontent.com/pluja/whishper/main/docker-compose.yml
|
||||
|
||||
# Copy env.example to .env
|
||||
# check if .env exists
|
||||
if [ -f .env ]; then
|
||||
echo ".env file already exists"
|
||||
echo "Do you want to overwrite it? (y/n)"
|
||||
read answer
|
||||
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||
echo "Copying env.example to .env"
|
||||
cp env.example .env
|
||||
fi
|
||||
else
|
||||
echo "Getting the default .env file from Github"
|
||||
curl -o .env https://raw.githubusercontent.com/pluja/whishper/main/example.env
|
||||
fi
|
||||
|
||||
# Create necessary directories for libretranslate
|
||||
echo "Creating necessary directories for libretranslate"
|
||||
sudo mkdir -p ./whishper_data/libretranslate/{data,cache}
|
||||
|
||||
# This permissions are for libretranslate docker container
|
||||
echo "Setting permissions for libretranslate"
|
||||
sudo chown -R 1032:1032 ./whishper_data/libretranslate
|
||||
|
||||
echo "Do you want to pull and build docker images? (y/n)"
|
||||
read answer
|
||||
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||
echo "Pulling and building docker images"
|
||||
sudo docker compose pull
|
||||
fi
|
||||
|
||||
echo "Do you want to start the containers? (y/n)"
|
||||
read answer
|
||||
if [ "$answer" != "${answer#[Yy]}" ] ;then
|
||||
echo "Starting whishper..."
|
||||
sudo docker compose up -d
|
||||
fi
|
||||
Reference in New Issue
Block a user