From 2dd6a165c44cc5ab0008142984330faa6c64da59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Garrigue?= Date: Thu, 20 Aug 2015 13:06:37 +0000 Subject: [PATCH] Basic remove / backup / restore script adapted from yunohost example app, missing database remove / backup / restore --- scripts/backup | 17 +++++++++++++++++ scripts/install | 2 +- scripts/remove | 20 ++++++++++++++++++++ scripts/restore | 18 ++++++++++++++++++ 4 files changed, 56 insertions(+), 1 deletion(-) mode change 100644 => 100755 scripts/backup mode change 100644 => 100755 scripts/remove mode change 100644 => 100755 scripts/restore diff --git a/scripts/backup b/scripts/backup old mode 100644 new mode 100755 index e69de29..00c9e31 --- a/scripts/backup +++ b/scripts/backup @@ -0,0 +1,17 @@ +#!/bin/bash +# DotClear 2 backup script for YunoHost + +app=dotclear2 + +# The parameter $1 is the backup directory location +# which will be compressed afterward +backup_dir=$1/apps/$app +sudo mkdir -p $backup_dir + +# Backup sources & data +sudo cp -a /var/www/$app/. $backup_dir/sources + +# Copy Nginx and YunoHost parameters to make the script "standalone" +sudo cp -a /etc/yunohost/apps/$app/. $backup_dir/yunohost +domain=$(sudo yunohost app setting $app domain) +sudo cp -a /etc/nginx/conf.d/$domain.d/$app.conf $backup_dir/nginx.conf diff --git a/scripts/install b/scripts/install index 8175d30..7dec5b5 100755 --- a/scripts/install +++ b/scripts/install @@ -23,7 +23,7 @@ master_key=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0 firstname=`sudo yunohost user info $admin | grep firstname | cut -d' ' -f2 | tr -d '\n'` lastname=`sudo yunohost user info $admin | grep lastname | cut -d' ' -f2 | tr -d '\n'` email=`sudo yunohost user info $admin | grep mail | cut -d' ' -f2 | tr -d '\n'` -TZ=Europe/Paris +TZ=`cat /etc/timezone|tr -d '\n'` # Save app settings sudo yunohost app setting $app admin -v "$admin" diff --git a/scripts/remove b/scripts/remove old mode 100644 new mode 100755 index e69de29..6850b14 --- a/scripts/remove +++ b/scripts/remove @@ -0,0 +1,20 @@ +#!/bin/bash +# DotClear 2 remove script for YunoHost + +app=dotclear2 + +# Retrieve arguments +domain=$(sudo yunohost app setting $app domain) +path=$(sudo yunohost app setting $app path) +admin=$(sudo yunohost app setting $app admin) +is_public=$(sudo yunohost app setting $app is_public) + +# Remove sources +sudo rm -rf /var/www/$app + +# Remove configuration files +sudo rm -f /etc/nginx/conf.d/$domain.d/$app.conf + +# Restart services +sudo service nginx reload +sudo yunohost app ssowatconf diff --git a/scripts/restore b/scripts/restore old mode 100644 new mode 100755 index e69de29..7df2c53 --- a/scripts/restore +++ b/scripts/restore @@ -0,0 +1,18 @@ +#!/bin/bash +# DotClear 2 restore script for YunoHost + +app=dotclear2 + +# The parameter $1 is the uncompressed restore directory location +backup_dir=$1/apps/$app + +# Restore sources & data +sudo cp -a $backup_dir/sources/. /var/www/$app + +# Restore Nginx and YunoHost parameters +sudo cp -a $backup_dir/yunohost/. /etc/yunohost/apps/$app +domain=$(sudo yunohost app setting $app domain) +sudo cp -a $backup_dir/nginx.conf /etc/nginx/conf.d/$domain.d/$app.conf + +# Restart webserver +sudo service nginx reload