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

Restore rework

This commit is contained in:
Jean-Baptiste Holcroft 2017-09-22 09:05:28 +02:00
parent b36ebe8fd0
commit 27b5edf718

View file

@ -60,22 +60,14 @@ ynh_restore_file "$final_path"
#================================================= #=================================================
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create $app ynh_system_user_create "$app"
#=================================================
# RESTORE THE PostgreSQL DATABASE
#=================================================
db_pwd=$(ynh_app_setting_get $app pgsqlpwd)
ynh_psql_setup_db $db_name $db_name $db_pwd
ynh_psql_connect_as $db_name $db_pwd $db_name < ./db.sql
#================================================= #=================================================
# RESTORE USER RIGHTS # RESTORE USER RIGHTS
#================================================= #=================================================
# Restore permissions on app files # Restore permissions on app files
chown -R root: $final_path chown -R "$app": "$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -83,14 +75,19 @@ chown -R root: $final_path
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
# Define and install dependencies
ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \ ynh_install_app_dependencies libxml2-dev libxslt-dev libfreetype6-dev \
libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv libjpeg-dev libz-dev libyaml-dev python-dev python-pip python-virtualenv \
postgresql libpq-dev uwsgi uwsgi-plugin-python
virtualenv ${final_path}/venv #=================================================
source ${final_path}/venv/bin/activate # RESTORE THE PostgreSQL DATABASE
pip install Weblate==2.16 #=================================================
pip install pytz python-bidi PyYaML Babel pyuca pylibravatar pydns
ynh_psql_test_if_first_run
db_pwd=$(ynh_app_setting_get "$app" pgsqlpwd)
ynh_psql_setup_db "$db_name $db_name" "$db_pwd"
ynh_psql_connect_as "$db_name" "$db_pwd" "$db_name" < ./db.sql
#================================================= #=================================================
# RESTORE THE SERVICE # RESTORE THE SERVICE
@ -102,7 +99,7 @@ ynh_restore_file "/etc/systemd/system/$app.service"
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app.service --log "/var/log/$app/APP.log" yunohost service add "$app.service" --log "/var/log/$app/APP.log"
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE THE CRON FILE
@ -123,4 +120,4 @@ ynh_restore_file "/etc/logrotate.d/$app"
#================================================= #=================================================
systemctl reload nginx systemctl reload nginx
systemctl reload $app.service systemctl reload "$app.service"