1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/libretranslate_ynh.git synced 2024-09-03 19:36:00 +02:00
This commit is contained in:
lotigara 2024-07-20 11:45:30 +00:00 committed by GitHub
commit 138ff8f268
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 2 deletions

View file

@ -34,6 +34,13 @@ ram.runtime = "50M"
type = "group"
default = "visitors"
[install.additional_languages]
ask.en = "Do install additional language models? WARNING: It will take ~6 GB of your free space"
help.en = "By default, installed models are English->French and French->English."
yes = "true"
no = "false"
type = "boolean"
[resources]
[resources.sources]

View file

@ -10,9 +10,9 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
# SETUP PERMISSIONS
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_script_progression --message="Setting up permissions..." --weight=1
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
@ -27,6 +27,22 @@ pushd $install_dir
python3 -m venv $install_dir/venv
source $install_dir/venv/bin/activate
ynh_exec_warn_less pip install libretranslate=="$(ynh_app_upstream_version)" toml
# WARNING!!! CODE BELOW WASN'T TESTED!!! RUN IN DEBUG MODE FROM SHELL!!!
# Checking if additional_languages was enabled...
if [ "$additional_languages" = true ] ; then
ynh_script_progression --message="Installing additional models..." --weight=5
# ...if yes, download models...
venv/bin/libretranslate --update-models --port 50005 &
export LT_PID="$!"
# ...and then kill the libretranslate WebUI / API
# because it was started after downloading models!
until ss -tulpen | grep '127.0.0.1:50005' ; do
kill -INT "$LT_PID"
done
fi
popd
#=================================================