diff --git a/scripts/restore b/scripts/restore new file mode 100644 index 0000000..f75adf3 --- /dev/null +++ b/scripts/restore @@ -0,0 +1,36 @@ +#!/bin/bash + +set -eu +# Récupère les infos de l'application. +app=$YNH_APP_INSTANCE_NAME + +# Source app helpers +source /usr/share/yunohost/helpers + +final_path=$(ynh_app_setting_get $app final_path) +domain=$(ynh_app_setting_get $app domain) + +# The parameter $1 is the uncompressed restore directory location +backup_dir=$1/apps/$app + +# Restore sources & data +sudo cp -a $backup_dir/sources/. $final_path + +# Restore Nginx and YunoHost parameters +sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app +sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf + + +sudo apt-get update +sudo apt-get install npm nodejs nodejs-legacy -qy + +# Restauration des fichiers du script systemd +sudo cp -a $backup_dir/${app}.service /etc/systemd/system/${app}.service +## Démarrage auto du service +sudo systemctl enable ${app}.service + +# Restart webserver +sudo service nginx reload + +# Start scrumblr +sudo service $app start