Update LibreTranslate
This commit is contained in:
parent
76538742c0
commit
f1bb19d665
@ -28,23 +28,20 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/Casvt/Kapowarr/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
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/.kapowarr)" ]] || [[ ! -f $HOME/.kapowarr ]]; then
|
if [[ "${RELEASE}" != "$(cat $HOME/.libretranslate)" ]] || [[ ! -f $HOME/.libretranslate ]]; then
|
||||||
msg_info "Stopping $APP"
|
msg_info "Stopping $APP"
|
||||||
systemctl stop kapowarr
|
systemctl stop libretranslate
|
||||||
msg_ok "Stopped $APP"
|
msg_ok "Stopped $APP"
|
||||||
|
|
||||||
msg_info "Creating Backup"
|
|
||||||
mv /opt/kapowarr/db /opt/
|
|
||||||
msg_ok "Backup Created"
|
|
||||||
|
|
||||||
msg_info "Updating $APP to ${RELEASE}"
|
msg_info "Updating $APP to ${RELEASE}"
|
||||||
fetch_and_deploy_gh_release "kapowarr" "Casvt/Kapowarr"
|
cd /opt/libretranslate
|
||||||
mv /opt/db /opt/kapowarr
|
source .venv/bin/activate
|
||||||
|
$STD pip install -U libretranslate
|
||||||
msg_ok "Updated $APP to ${RELEASE}"
|
msg_ok "Updated $APP to ${RELEASE}"
|
||||||
|
|
||||||
msg_info "Starting $APP"
|
msg_info "Starting $APP"
|
||||||
systemctl start kapowarr
|
systemctl start libretranslate
|
||||||
msg_ok "Started $APP"
|
msg_ok "Started $APP"
|
||||||
|
|
||||||
msg_ok "Update Successful"
|
msg_ok "Update Successful"
|
||||||
|
@ -17,11 +17,15 @@ msg_info "Installing dependencies"
|
|||||||
$STD apt-get install -y --no-install-recommends \
|
$STD apt-get install -y --no-install-recommends \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
gcc \
|
gcc \
|
||||||
g++
|
g++ \
|
||||||
msg_ok "Setup Python3"
|
libicu-dev
|
||||||
|
msg_ok "Installed dependencies"
|
||||||
|
|
||||||
msg_info "Setup Python3"
|
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"
|
msg_ok "Setup Python3"
|
||||||
|
|
||||||
setup_uv
|
setup_uv
|
||||||
@ -31,8 +35,9 @@ msg_info "Setup LibreTranslate (Patience)"
|
|||||||
cd /opt/libretranslate
|
cd /opt/libretranslate
|
||||||
$STD uv venv .venv
|
$STD uv venv .venv
|
||||||
$STD source .venv/bin/activate
|
$STD source .venv/bin/activate
|
||||||
$STD uv pip install --upgrade pip
|
$STD uv pip install --upgrade pip setuptools
|
||||||
$STD uv pip install Babel==2.12.1 && .venv/bin/python scripts/compile_locales.py
|
$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 torch==2.2.0 --extra-index-url https://download.pytorch.org/whl/cpu
|
||||||
$STD uv pip install "numpy<2"
|
$STD uv pip install "numpy<2"
|
||||||
$STD uv pip install .
|
$STD uv pip install .
|
||||||
@ -51,7 +56,7 @@ User=root
|
|||||||
Type=idle
|
Type=idle
|
||||||
Restart=always
|
Restart=always
|
||||||
Environment="PATH=/usr/local/lib/python3.11/dist-packages/libretranslate"
|
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
|
ExecReload=/bin/kill -s HUP
|
||||||
KillMode=mixed
|
KillMode=mixed
|
||||||
TimeoutStopSec=1
|
TimeoutStopSec=1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user