1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nextcloud_ynh.git synced 2024-09-03 19:55:57 +02:00

add support for custom data directory

This commit is contained in:
Tobias Ollive 2021-05-14 13:28:38 +02:00
parent 77a7a5684e
commit 4629333cd5
4 changed files with 16 additions and 4 deletions

View file

@ -8,6 +8,16 @@ pkg_dependencies="imagemagick acl tar smbclient at"
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-smbclient php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-igbinary php${YNH_PHP_VERSION}-bcmath"
set_datadir() {
if [[ -f $final_path/config/config.php ]]; then
datadir=$(grep datadirectory < $final_path/config/config.php | sed "s/.*=>.'\([^']*\)'.*/\1/")
else
datadir="/home/yunohost.app/$app/data"
fi
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -84,7 +84,9 @@ ynh_backup --src_path="/etc/cron.d/$app"
#=================================================
ynh_print_info --message="Backing up data directory..."
ynh_backup --src_path="/home/yunohost.app/${app}/data" --is_big
set_datadir
ynh_backup --src_path="$datadir" --is_big
#=================================================
# END OF SCRIPT

View file

@ -121,7 +121,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
ynh_script_progression --message="Restoring data directory..." --weight=2
datadir="/home/yunohost.app/$app/data"
set_datadir
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="$datadir" --not_mandatory

View file

@ -202,8 +202,8 @@ local mount_id=$(exec_occ files_external:create --output=json \
&& ynh_print_warn --message="Unable to create external storage" \
|| exec_occ files_external:option "$mount_id" enable_sharing true
}
# Define app's data directory
datadir="/home/yunohost.app/$app/data"
# Define app's data directory (defined in _common.sh)
set_datadir
if [ "$upgrade_type" == "UPGRADE_APP" ]
then