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

[enh] Use latest backup specification.

This commit is contained in:
opi 2016-05-07 01:32:32 +02:00
parent 2b8b62dd3a
commit a3fc2280a1
3 changed files with 48 additions and 16 deletions

View file

@ -2,6 +2,9 @@
"name": "Dokuwiki",
"id": "dokuwiki",
"packaging_format": 1,
"requirements": {
"yunohost": ">> 2.3.12.1"
},
"description": {
"en": "DokuWiki is a simple to use and highly versatile Open Source wiki software that doesn't require a database.",
"fr": "DokuWiki est un wiki Open Source simple à utiliser et très polyvalent qui n'exige aucune base de données.",

View file

@ -1,17 +1,33 @@
#!/bin/bash
# The parameter $1 is the backup directory location dedicated to the app
backup_dir=$1
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# The parameter $2 is theid of the app instance
app=$2
# Source YNH helpers
. /usr/share/yunohost/helpers
# This is a multi-instance app, meaning it can be installed several times independently
# The id of the app as stated in the manifest is available as $YNH_APP_ID
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
# The app instance name is available as $YNH_APP_INSTANCE_NAME
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
# The app instance name is probably what you are interested the most, since this is
# guaranteed to be unique. This is a good unique identifier to define installation path,
# db names, ...
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path)
# Backup directory location for the app from where the script is executed and
# which will be compressed afterward
backup_dir=$YNH_APP_BACKUP_DIR
# Backup sources & data
ynh_backup "/var/www/$app" "sources"
# Copy Nginx
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf"
# Copy Nginx conf
sudo mkdir -p ./conf
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"

View file

@ -1,11 +1,25 @@
#!/bin/bash
# This restore script is adapted to Yunohost >=2.4
# The parameter $1 is the backup directory location dedicated to the app
backup_dir=$1
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e
# The parameter $2 is the id of the app instance ex: ynhexample__2
app=$2
# Source YNH helpers
. /usr/share/yunohost/helpers
# This is a multi-instance app, meaning it can be installed several times independently
# The id of the app as stated in the manifest is available as $YNH_APP_ID
# The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...)
# The app instance name is available as $YNH_APP_INSTANCE_NAME
# - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample
# - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2
# - ynhexample__{N} for the subsequent installations, with N=3,4, ...
# The app instance name is probably what you are interested the most, since this is
# guaranteed to be unique. This is a good unique identifier to define installation path,
# db names, ...
app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments
domain=$(sudo yunohost app setting $app domain)
# Get old parameter of the app
domain=$(sudo yunohost app setting $app domain)
@ -21,6 +35,7 @@ if [[ ! $? -eq 0 ]]; then
fi
final_path=/var/www/$app
if [ -d $final_path ]; then
echo "There is already a directory: $final_path " | sudo tee /dev/stderr
exit 1
@ -33,14 +48,14 @@ if [ -f $conf ]; then
fi
# Restore sources & data
sudo cp -a "${backup_dir}/sources" $final_path
sudo cp -a "./sources" $final_path
# Set permissions
sudo chown -R www-data:root $final_path/{conf,data,data/attic,data/cache,data/index,data/locks,data/media*,data/meta,data/pages,data/tmp,lib/plugins}
sudo chmod -R 700 $final_path/{conf,data,data/attic,data/cache,data/index,data/locks,data/media*,data/meta,data/pages,data/tmp,lib/plugins}
# Restore conf files
sudo cp -a "${backup_dir}/nginx.conf" $conf
sudo cp -a "./conf/nginx.conf" $conf
# Reload Nginx
sudo service nginx reload
@ -50,5 +65,3 @@ if [ "$is_public" = "Yes" ];
then
sudo yunohost app setting dokuwiki unprotected_uris -v "/"
fi
sudo service nginx reload