#!/bin/bash ######## Actually we cant use common script in backup / restore script see this issue for more informations : https://dev.yunohost.org/issues/621 # # Import common cmd # source ./_common.sh # ######## We implement manually this fonctions init_script() { # Exit on command errors and treat unset variables as an error set -eu # Source YunoHost helpers source /usr/share/yunohost/helpers # Retrieve arguments app=$YNH_APP_INSTANCE_NAME } ######## End of common fonctions # Init script init_script # Note: each files and directories you've saved using the ynh_backup helper # will be located in the current directory, regarding the last argument. # Retrieve old app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) # Correct path if it is not correct CHECK_PATH # Check domain/path availability sudo yunohost app checkurl "${domain}${path}" -a "$app" \ || ynh_die "Path not available: ${domain}${path}" # Download package get_source # Install package ynh_package_update ynh_package_install rrdtool perl libwww-perl libmailtools-perl libmime-lite-perl librrds-perl libdbi-perl libxml-simple-perl libhttp-server-simple-perl libconfig-general-perl sudo dpkg -i /tmp/monitorix.deb ynh_package_install -f # # Create and restore the database dbname=$app dbuser=$app dbpass=$(ynh_app_setting_get "$app" mysqlpwd) ynh_mysql_create_db "$dbname" "$dbuser" "$dbpass" ynh_mysql_connect_as "$dbuser" "$dbpass" "$dbname" < ./dump.sql # Restore NGINX configuration sudo cp -a ./nginx.conf "/etc/nginx/conf.d/${domain}.d/${app}.conf" sudo cp -a ./monitorix_status.conf "/etc/nginx/conf.d/monitorix_status.conf" # Restore Monitorix configuration sudo cp -a ./config "/etc/monitorix" # Restart webserver sudo service nginx reload