#!/bin/bash set -eu # Import helpers source /usr/share/yunohost/helpers source ../settings/scripts/_future.sh source ../settings/scripts/_common.sh ynh_abort_if_errors export app=$YNH_APP_INSTANCE_NAME export domain=$(ynh_app_setting_get $app domain) export odoo_version=$(ynh_app_setting_get $app odoo_version) export oca=$(ynh_app_setting_get $app oca) export port=$(ynh_app_setting_get $app port) export port_chat=$(ynh_app_setting_get $app port_chat) export db_name=$(ynh_app_setting_get $app db_name) export is_public=0 #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= ynh_webpath_available "$domain" "/" #================================================= # RESTORE THE APP BY MODIFYING THE SYSTEM #================================================= # Restore files function restore_files () { ynh_restore chown -R $app:$app $final_path chown $app:$app $conf_file touch /var/log/$app.log chown $app:$app /var/log/$app.log } # Restore database function restore_database () { su -c "psql $app" postgres < ./dump.sql } ynh_psql_test_if_first_run ynh_psql_setup_db $db_name $db_name $db_pass ynh_system_user_create $app $final_path restore_files install_dependencies add_services restore_database ssowat_and_restart