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:
parent
2b8b62dd3a
commit
a3fc2280a1
3 changed files with 48 additions and 16 deletions
|
@ -2,6 +2,9 @@
|
||||||
"name": "Dokuwiki",
|
"name": "Dokuwiki",
|
||||||
"id": "dokuwiki",
|
"id": "dokuwiki",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
|
"requirements": {
|
||||||
|
"yunohost": ">> 2.3.12.1"
|
||||||
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"en": "DokuWiki is a simple to use and highly versatile Open Source wiki software that doesn't require a database.",
|
"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.",
|
"fr": "DokuWiki est un wiki Open Source simple à utiliser et très polyvalent qui n'exige aucune base de données.",
|
||||||
|
|
|
@ -1,17 +1,33 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# The parameter $1 is the backup directory location dedicated to the app
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
backup_dir=$1
|
set -e
|
||||||
|
|
||||||
# The parameter $2 is theid of the app instance
|
# Source YNH helpers
|
||||||
app=$2
|
. /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)
|
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
|
# Backup sources & data
|
||||||
ynh_backup "/var/www/$app" "sources"
|
ynh_backup "/var/www/$app" "sources"
|
||||||
|
|
||||||
# Copy Nginx
|
# Copy Nginx conf
|
||||||
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "nginx.conf"
|
sudo mkdir -p ./conf
|
||||||
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
|
||||||
|
|
|
@ -1,11 +1,25 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# This restore script is adapted to Yunohost >=2.4
|
|
||||||
|
|
||||||
# The parameter $1 is the backup directory location dedicated to the app
|
# causes the shell to exit if any subcommand or pipeline returns a non-zero status
|
||||||
backup_dir=$1
|
set -e
|
||||||
|
|
||||||
# The parameter $2 is the id of the app instance ex: ynhexample__2
|
# Source YNH helpers
|
||||||
app=$2
|
. /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
|
# Get old parameter of the app
|
||||||
domain=$(sudo yunohost app setting $app domain)
|
domain=$(sudo yunohost app setting $app domain)
|
||||||
|
@ -21,6 +35,7 @@ if [[ ! $? -eq 0 ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
final_path=/var/www/$app
|
final_path=/var/www/$app
|
||||||
|
|
||||||
if [ -d $final_path ]; then
|
if [ -d $final_path ]; then
|
||||||
echo "There is already a directory: $final_path " | sudo tee /dev/stderr
|
echo "There is already a directory: $final_path " | sudo tee /dev/stderr
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -33,14 +48,14 @@ if [ -f $conf ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Restore sources & data
|
# Restore sources & data
|
||||||
sudo cp -a "${backup_dir}/sources" $final_path
|
sudo cp -a "./sources" $final_path
|
||||||
|
|
||||||
# Set permissions
|
# 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 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}
|
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
|
# Restore conf files
|
||||||
sudo cp -a "${backup_dir}/nginx.conf" $conf
|
sudo cp -a "./conf/nginx.conf" $conf
|
||||||
|
|
||||||
# Reload Nginx
|
# Reload Nginx
|
||||||
sudo service nginx reload
|
sudo service nginx reload
|
||||||
|
@ -50,5 +65,3 @@ if [ "$is_public" = "Yes" ];
|
||||||
then
|
then
|
||||||
sudo yunohost app setting dokuwiki unprotected_uris -v "/"
|
sudo yunohost app setting dokuwiki unprotected_uris -v "/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo service nginx reload
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue