From d963f0799257898b2d74ae3f67f8d51ba932d74c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 28 Aug 2021 18:56:58 +0200 Subject: [PATCH] Add datatdir --- conf/php-fpm.conf | 1 + scripts/backup | 7 +++++++ scripts/install | 14 ++++++++++++++ scripts/restore | 14 ++++++++++++++ 4 files changed, 36 insertions(+) diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 7f2c855..a982348 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -431,3 +431,4 @@ php_admin_value[post_max_size] = 1G ; env[IFM_AUTH] = 1 ; env[IFM_AUTH_SOURCE] = ldap;127.0.0.1:389;ou=users,dc=yunohost,dc=org;(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org)) +env[IFM_ROOT_DIR] = /home/yunohost.app/__APP__ diff --git a/scripts/backup b/scripts/backup index 75ce3e0..0e4f0f0 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,6 +27,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -39,6 +40,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= diff --git a/scripts/install b/scripts/install index d97636f..2da932c 100755 --- a/scripts/install +++ b/scripts/install @@ -86,6 +86,20 @@ ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 ynh_add_fpm_config --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# CREATE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Creating a data directory..." --weight=1 + +datadir=/home/yunohost.app/$app +ynh_app_setting_set --app=$app --key=datadir --value=$datadir + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # SETUP SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index e0a7127..4d8ef9b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -28,6 +28,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -67,6 +68,19 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:www-data "$datadir" + #================================================= # RESTORE THE PHP-FPM CONFIGURATION #=================================================