1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

fix install and upgrade

This commit is contained in:
Kay0u 2021-05-03 14:15:42 +02:00
parent b3dea800bf
commit 603f194e84
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
2 changed files with 18 additions and 20 deletions

View file

@ -119,20 +119,19 @@ ynh_script_progression --message="Install weblate using PIP..." --weight=80
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
virtualenv --python=python3 "${final_path}/venv" virtualenv --python=python3 "${final_path}/venv"
chown -R "$app": "$final_path"
#run source in a 'sub shell' #run source in a 'sub shell'
( (
set +o nounset set +o nounset
source "${final_path}/venv/bin/activate" source "${final_path}/venv/bin/activate"
set -o nounset set -o nounset
sudo -u $app $final_path/venv/bin/pip install --upgrade pip setuptools wheel $final_path/venv/bin/pip install --upgrade pip setuptools wheel
# Still needed with latest version of weblate? # Still needed with latest version of weblate?
sudo -u $app $final_path/venv/bin/pip install Weblate=="$weblate_version" $final_path/venv/bin/pip install Weblate=="$weblate_version"
sudo -u $app $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply
#pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml #pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml
# specific to YunoHost package: # specific to YunoHost package:
sudo -u $app $final_path/venv/bin/pip install django_sendmail_backend $final_path/venv/bin/pip install django_sendmail_backend
) )
#================================================= #=================================================
@ -183,17 +182,17 @@ ynh_script_progression --message="Filling up the database..." --weight=10
set -o nounset set -o nounset
export DJANGO_SETTINGS_MODULE="weblate.settings" export DJANGO_SETTINGS_MODULE="weblate.settings"
# the user needs to be weblate for postgresql # the user needs to be weblate for postgresql
sudo -u $app $final_path/venv/bin/weblate migrate --noinput $final_path/venv/bin/weblate migrate --noinput
# generate static files # generate static files
sudo -u $app $final_path/venv/bin/weblate collectstatic --noinput $final_path/venv/bin/weblate collectstatic --noinput
sudo -u $app $final_path/venv/bin/weblate createadmin --no-color \ $final_path/venv/bin/weblate createadmin --no-color \
--password "$password" \ --password "$password" \
--username "$admin" \ --username "$admin" \
--email "$admin_mail" --email "$admin_mail"
# Check the configuration # Check the configuration
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later. # This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
sudo -u $app $final_path/venv/bin/weblate check --deploy || true $final_path/venv/bin/weblate check --deploy || true
) )
#================================================= #=================================================

View file

@ -171,20 +171,19 @@ upgrade() {
ynh_systemd_action --service_name="$app-celery" --action="stop" ynh_systemd_action --service_name="$app-celery" --action="stop"
virtualenv --python=python3 "${final_path}/venv" virtualenv --python=python3 "${final_path}/venv"
chown -R "$app": "$final_path/venv"
#run source in a 'sub shell' #run source in a 'sub shell'
( (
set +o nounset set +o nounset
source "${final_path}/venv/bin/activate" source "${final_path}/venv/bin/activate"
set -o nounset set -o nounset
sudo -u $app $final_path/venv/bin/pip install --upgrade pip setuptools wheel $final_path/venv/bin/pip install --upgrade pip setuptools wheel
# Still needed with latest version of weblate? # Still needed with latest version of weblate?
sudo -u $app $final_path/venv/bin/pip install --upgrade Weblate=="$new_version" $final_path/venv/bin/pip install --upgrade Weblate=="$new_version"
sudo -u $app $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply
#pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml #pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml
# specific to YunoHost package: # specific to YunoHost package:
sudo -u $app $final_path/venv/bin/pip install django_sendmail_backend $final_path/venv/bin/pip install django_sendmail_backend
) )
#================================================= #=================================================
@ -235,16 +234,16 @@ upgrade() {
export DJANGO_SETTINGS_MODULE="weblate.settings" export DJANGO_SETTINGS_MODULE="weblate.settings"
cd "${final_path}" cd "${final_path}"
sudo -u $app $final_path/venv/bin/weblate migrate --noinput $final_path/venv/bin/weblate migrate --noinput
sudo -u $app $final_path/venv/bin/weblate collectstatic --noinput $final_path/venv/bin/weblate collectstatic --noinput
sudo -u $app $final_path/venv/bin/weblate setuplang $final_path/venv/bin/weblate setuplang
sudo -u $app $final_path/venv/bin/weblate setupgroups $final_path/venv/bin/weblate setupgroups
sudo -u $app $final_path/venv/bin/weblate compilemessages $final_path/venv/bin/weblate compilemessages
# Check the configuration # Check the configuration
# This may fail in some cases with errors, etc., but the app works and the user can fix issues later. # This may fail in some cases with errors, etc., but the app works and the user can fix issues later.
if [ "$new_version" == "$weblate_version" ]; then if [ "$new_version" == "$weblate_version" ]; then
sudo -u $app $final_path/venv/bin/weblate check --deploy || true $final_path/venv/bin/weblate check --deploy || true
fi fi
) )
} }