2024-12-02 22:55:11 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
arch=$(uname -m)
|
|
|
|
|
|
|
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|
|
|
download_url="https://github.com/kennethnym/tesseract/releases/latest/download/tesseract_Linux_$arch.tar.gz"
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
download_url="https://github.com/kennethnym/tesseract/releases/latest/download/tesseract_Darwin_$arch.tar.gz"
|
|
|
|
else
|
|
|
|
echo "Unsupported OS! tesseract only supports Linux or Darwin."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Downloading from $download_url..."
|
|
|
|
|
|
|
|
mkdir -p /tmp/tesseract
|
|
|
|
curl -L --output /tmp/tesseract/tesseract.tar.gz "$download_url"
|
|
|
|
tar -xvzf /tmp/tesseract/tesseract.tar.gz -C /tmp/tesseract
|
|
|
|
|
|
|
|
sudo mkdir -p /opt/tesseract
|
|
|
|
sudo mv /tmp/tesseract/tesseract /opt/tesseract
|
2024-12-02 23:07:23 +00:00
|
|
|
sudo chown "$(whoami)" /opt/tesseract
|
|
|
|
cat >/opt/tesseract/config.json <<EOF
|
2024-12-02 22:55:11 +00:00
|
|
|
{
|
|
|
|
"port": 80,
|
|
|
|
"databasePath": "./data.sqlite",
|
2024-12-02 23:03:06 +00:00
|
|
|
"hostName": "HOSTNAME",
|
|
|
|
"debug": false
|
2024-12-02 22:55:11 +00:00
|
|
|
}
|
|
|
|
EOF
|
2024-12-02 23:07:23 +00:00
|
|
|
sudo chown "$(whoami)" /opt/tesseract/*
|
2024-12-02 22:55:11 +00:00
|
|
|
|
|
|
|
rm -r /tmp/tesseract
|
|
|
|
|
|
|
|
echo "tesseract installed successfully to /opt/tesseract."
|
|
|
|
echo "Before running tesseract, make sure that you specify the host name in config.json."
|