mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
fix scripts
This commit is contained in:
parent
d43693f8e8
commit
33182706ed
4 changed files with 42 additions and 38 deletions
|
@ -106,16 +106,17 @@ fi
|
|||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# MODIFY settings.py
|
||||
# MODIFY SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Modify weblate's config file..." --time --weight=1
|
||||
|
||||
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
|
||||
ynh_backup_if_checksum_is_different --file="$settings"
|
||||
|
||||
# Change the path in the nginx config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="URL_PREFIX = '${old_path%/}'" --replace_string="URL_PREFIX = '${new_path%/}'" --target_file="$settings"
|
||||
ynh_replace_string --match_string="URL_PREFIX = \"${old_path%/}\"" --replace_string="URL_PREFIX = \"${new_path%/}\"" --target_file="$settings"
|
||||
fi
|
||||
|
||||
# Change the domain for nginx
|
||||
|
@ -124,11 +125,26 @@ then
|
|||
# replace SERVER_EMAIL
|
||||
ynh_replace_string --match_string="noreply@$old_domain" --replace_string="noreply@$new_domain" --target_file="$settings"
|
||||
# replace ALLOWED_HOSTS
|
||||
ynh_replace_string --match_string="['$old_domain']" --replace_string="['$new_domain']" --target_file="$settings"
|
||||
ynh_replace_string --match_string="ALLOWED_HOSTS = \[\"$old_domain\"\]" --replace_string="ALLOWED_HOSTS = \[\"$new_domain\"\]" --target_file="$settings"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$settings"
|
||||
|
||||
#=================================================
|
||||
# MODIFY UWSGI
|
||||
#=================================================
|
||||
|
||||
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
||||
ynh_backup_if_checksum_is_different --file="$finaluwsgiini"
|
||||
|
||||
# Change the path in the nginx config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
ynh_replace_string --match_string="mount = $old_path=" --replace_string="mount = $new_path=" --target_file="$finaluwsgiini"
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$finaluwsgiini"
|
||||
|
||||
#=================================================
|
||||
# ChangeSite inside weblate
|
||||
#=================================================
|
||||
|
@ -137,7 +153,7 @@ ynh_script_progression --message="Run weblate's command changesite..." --time --
|
|||
set +eu
|
||||
source "${final_path}/venv/bin/activate"
|
||||
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
||||
weblate changesite --set-name "$new_domain"
|
||||
sudo -u $app $final_path/venv/bin/weblate changesite --set-name "$new_domain"
|
||||
)
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -121,14 +121,14 @@ virtualenv --python=python3 "${final_path}/venv"
|
|||
set +o nounset
|
||||
source "${final_path}/venv/bin/activate"
|
||||
set -o nounset
|
||||
pip install --upgrade pip setuptools wheel
|
||||
sudo -u $app $final_path/venv/bin/pip install --upgrade pip setuptools wheel
|
||||
# Still needed with latest version of weblate?
|
||||
pip install celery==4.*
|
||||
pip install Weblate=="$current_version"
|
||||
pip install psycopg2-binary ruamel.yaml aeidon phply
|
||||
sudo -u $app $final_path/venv/bin/pip install celery==4.*
|
||||
sudo -u $app $final_path/venv/bin/pip install Weblate=="$current_version"
|
||||
sudo -u $app $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
|
||||
# specific to YunoHost package:
|
||||
pip install django_sendmail_backend
|
||||
sudo -u $app $final_path/venv/bin/pip install django_sendmail_backend
|
||||
)
|
||||
|
||||
#=================================================
|
||||
|
@ -174,11 +174,11 @@ ynh_script_progression --message="Filling up the database..." --time --weight=1
|
|||
set -o nounset
|
||||
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
||||
# the user needs to be weblate for postgresql
|
||||
weblate migrate --noinput
|
||||
sudo -u $app $final_path/venv/bin/weblate migrate --noinput
|
||||
# generate static files
|
||||
weblate collectstatic --noinput
|
||||
weblate changesite --set-name "$domain"
|
||||
weblate createadmin --no-color \
|
||||
sudo -u $app $final_path/venv/bin/weblate collectstatic --noinput
|
||||
sudo -u $app $final_path/venv/bin/weblate changesite --set-name "$domain"
|
||||
sudo -u $app $final_path/venv/bin/weblate createadmin --no-color \
|
||||
--password "weblate" \
|
||||
--username "$admin" \
|
||||
--email "$admin_mail"
|
||||
|
@ -234,15 +234,11 @@ ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.servic
|
|||
#=================================================
|
||||
|
||||
# Set permissions to app files
|
||||
chown -R root:root "$final_path"
|
||||
chown -R "$app": "$final_path/data"
|
||||
chown -R "$app": "$final_path"
|
||||
|
||||
mkdir -p "$final_path/avatar-cache"
|
||||
chown -R "$app": "$final_path/avatar-cache"
|
||||
|
||||
mkdir -p "/var/run/$app"
|
||||
chown -R "$app": "/var/run/$app"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
|
|
@ -67,15 +67,11 @@ ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
|
|||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R root:root "$final_path"
|
||||
chown -R "$app": "$final_path/data"
|
||||
chown -R "$app": "$final_path"
|
||||
|
||||
mkdir -p "$final_path/avatar-cache"
|
||||
chown -R "$app": "$final_path/avatar-cache"
|
||||
|
||||
mkdir -p "/var/run/$app"
|
||||
chown -R "$app": "/var/run/$app"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
|
|
|
@ -159,14 +159,14 @@ virtualenv --python=python3 "${final_path}/venv"
|
|||
set +o nounset
|
||||
source "${final_path}/venv/bin/activate"
|
||||
set -o nounset
|
||||
pip install --upgrade pip setuptools wheel
|
||||
sudo -u $app $final_path/venv/bin/pip install --upgrade pip setuptools wheel
|
||||
# Still needed with latest version of weblate?
|
||||
pip install celery==4.*
|
||||
pip install --upgrade Weblate=="$current_version"
|
||||
pip install psycopg2-binary ruamel.yaml aeidon phply
|
||||
sudo -u $app $final_path/venv/bin/pip install celery==4.*
|
||||
sudo -u $app $final_path/venv/bin/pip install --upgrade Weblate=="$current_version"
|
||||
sudo -u $app $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
|
||||
# specific to YunoHost package:
|
||||
pip install django_sendmail_backend
|
||||
sudo -u $app $final_path/venv/bin/pip install django_sendmail_backend
|
||||
)
|
||||
|
||||
#=================================================
|
||||
|
@ -212,11 +212,11 @@ ynh_systemd_action --service_name="$app-celery" --action="start"
|
|||
export DJANGO_SETTINGS_MODULE="weblate.settings"
|
||||
cd "${final_path}"
|
||||
|
||||
weblate migrate --noinput
|
||||
weblate collectstatic --noinput
|
||||
weblate setuplang
|
||||
weblate setupgroups
|
||||
weblate compilemessages
|
||||
sudo -u $app $final_path/venv/bin/weblate migrate --noinput
|
||||
sudo -u $app $final_path/venv/bin/weblate collectstatic --noinput
|
||||
sudo -u $app $final_path/venv/bin/weblate setuplang
|
||||
sudo -u $app $final_path/venv/bin/weblate setupgroups
|
||||
sudo -u $app $final_path/venv/bin/weblate compilemessages
|
||||
sudo -u $app $final_path/venv/bin/weblate check --deploy
|
||||
)
|
||||
|
||||
|
@ -243,15 +243,11 @@ yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log"
|
|||
#=================================================
|
||||
|
||||
# Set right permissions for curl installation
|
||||
chown -R root:root "$final_path"
|
||||
chown -R "$app": "$final_path/data"
|
||||
chown -R "$app": "$final_path"
|
||||
|
||||
mkdir -p "$final_path/avatar-cache"
|
||||
chown -R "$app": "$final_path/avatar-cache"
|
||||
|
||||
mkdir -p "/var/run/$app"
|
||||
chown -R "$app": "/var/run/$app"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICES
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue