#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RESTORE THE APP MAIN DIR #================================================= ynh_script_progression --message="Restoring the app main directory..." --weight=2 ynh_restore_file --origin_path="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" chmod +x $install_dir/metabase.jar #================================================= # SETUP CONFIG #================================================= ynh_script_progression --message="Restoring a configuration file..." --weight=1 ynh_restore_file --origin_path="/etc/default/$app" chmod 640 "/etc/default/$app" chown $app "/etc/default/$app" #================================================= # RESTORE THE POSTQRESQL DATABASE #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=2 ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= # RESTORE THE LOGROTATE CONFIGURATION #================================================= ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet yunohost service add $app --description="Web database management tool" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Please use the following URL to setup your Metabase installation:" ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Restoration completed for $app" --last