1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dotclear2_ynh.git synced 2024-09-03 18:26:29 +02:00

Basic remove / backup / restore script adapted from yunohost example app, missing database remove / backup / restore

This commit is contained in:
Rémy Garrigue 2015-08-20 13:06:37 +00:00
parent d69dcd7c49
commit 2dd6a165c4
4 changed files with 56 additions and 1 deletions

17
scripts/backup Normal file → Executable file
View file

@ -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

View file

@ -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'` 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'` 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'` 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 # Save app settings
sudo yunohost app setting $app admin -v "$admin" sudo yunohost app setting $app admin -v "$admin"

20
scripts/remove Normal file → Executable file
View file

@ -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

18
scripts/restore Normal file → Executable file
View file

@ -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