Update LibreTranslate

This commit is contained in:
tremor021 2025-06-13 14:35:30 +02:00
parent 76538742c0
commit f1bb19d665
2 changed files with 18 additions and 16 deletions

View File

@ -28,23 +28,20 @@ function update_script() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/Casvt/Kapowarr/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat $HOME/.kapowarr)" ]] || [[ ! -f $HOME/.kapowarr ]]; then
RELEASE=$(curl -s https://api.github.com/repos/LibreTranslate/LibreTranslate/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat $HOME/.libretranslate)" ]] || [[ ! -f $HOME/.libretranslate ]]; then
msg_info "Stopping $APP"
systemctl stop kapowarr
systemctl stop libretranslate
msg_ok "Stopped $APP"
msg_info "Creating Backup"
mv /opt/kapowarr/db /opt/
msg_ok "Backup Created"
msg_info "Updating $APP to ${RELEASE}"
fetch_and_deploy_gh_release "kapowarr" "Casvt/Kapowarr"
mv /opt/db /opt/kapowarr
cd /opt/libretranslate
source .venv/bin/activate
$STD pip install -U libretranslate
msg_ok "Updated $APP to ${RELEASE}"
msg_info "Starting $APP"
systemctl start kapowarr
systemctl start libretranslate
msg_ok "Started $APP"
msg_ok "Update Successful"

View File

@ -17,11 +17,15 @@ msg_info "Installing dependencies"
$STD apt-get install -y --no-install-recommends \
pkg-config \
gcc \
g++
msg_ok "Setup Python3"
g++ \
libicu-dev
msg_ok "Installed dependencies"
msg_info "Setup Python3"
$STD apt-get install -y python3-pip
$STD apt-get install -y \
python3-pip \
python3-dev \
python3-icu
msg_ok "Setup Python3"
setup_uv
@ -31,8 +35,9 @@ msg_info "Setup LibreTranslate (Patience)"
cd /opt/libretranslate
$STD uv venv .venv
$STD source .venv/bin/activate
$STD uv pip install --upgrade pip
$STD uv pip install Babel==2.12.1 && .venv/bin/python scripts/compile_locales.py
$STD uv pip install --upgrade pip setuptools
$STD uv pip install Babel==2.12.1
$STD .venv/bin/python scripts/compile_locales.py
$STD uv pip install torch==2.2.0 --extra-index-url https://download.pytorch.org/whl/cpu
$STD uv pip install "numpy<2"
$STD uv pip install .
@ -51,7 +56,7 @@ User=root
Type=idle
Restart=always
Environment="PATH=/usr/local/lib/python3.11/dist-packages/libretranslate"
ExecStart=/opt/libretranslate/.venv/bin/python3 /opt/libretranslate/.venv/bin/libretranslate --host *
ExecStart=/opt/libretranslate/.venv/bin/python3 /opt/libretranslate/.venv/bin/libretranslate --host * --update-models
ExecReload=/bin/kill -s HUP
KillMode=mixed
TimeoutStopSec=1