diff --git a/scripts/backup b/scripts/backup index 7bea1e1..7531796 100644 --- a/scripts/backup +++ b/scripts/backup @@ -7,10 +7,11 @@ source /usr/share/yunohost/helpers ynh_print_info "Declaring files to be backed up..." #================================================= -# BACKUP THE APP MAIN DIR +# BACKUP THE APP MAIN DIR & DATA DIR #================================================= ynh_backup "$install_dir" +ynh_backup "$data_dir" #================================================= # BACKUP THE NGINX CONFIGURATION @@ -44,7 +45,6 @@ ynh_backup "/etc/logrotate.d/$app" #================================================= ynh_backup "/etc/cron.d/$app" -ynh_backup "$data_dir" #================================================= # BACKUP THE DATABASE diff --git a/scripts/install b/scripts/install index f851eb8..dbca065 100755 --- a/scripts/install +++ b/scripts/install @@ -53,8 +53,6 @@ ynh_script_progression "Pulling in external libraries with Composer..." ynh_composer_install ynh_composer_exec install --no-dev -chown -R $app:www-data "$install_dir" - #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/restore b/scripts/restore index 9d4f088..d429835 100644 --- a/scripts/restore +++ b/scripts/restore @@ -5,11 +5,12 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= -# RESTORE THE APP MAIN DIR +# RESTORE THE APP MAIN DIR & DATA DIR #================================================= ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" +ynh_restore "$data_dir" #================================================= # RESTORE THE DATABASE @@ -33,7 +34,6 @@ ynh_systemctl --action=restart --service=fail2ban # RESTORE CRON JOBS #================================================= ynh_restore "/etc/cron.d/$app" -ynh_restore "$data_dir" #================================================= # RESTORE LOGROTATE diff --git a/scripts/upgrade b/scripts/upgrade index 92dfc64..8c26617 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -24,9 +24,12 @@ if ynh_app_upstream_version_changed then ynh_script_progression "Upgrading source files..." - # First we save what we need to keep - mv $install_dir/store $data_dir/ - mv $install_dir/cache $data_dir/ + # Move data to the data_dir if it's still in install_dir + if [ ! -d "$data_dir/store" ] + then + ynh_exec_as_app mv $install_dir/store $data_dir/ + ynh_exec_as_app mv $install_dir/cache $data_dir/ + fi # Then we remove the previous install ynh_safe_rm $install_dir @@ -35,10 +38,8 @@ then ynh_setup_source --dest_dir="$install_dir/addon" --source_id="addons" # We restore what we previously saved - mv $data_dir/store $install_dir/ - mv $data_dir/cache $install_dir/ - - ynh_exec_as_app chmod -R 775 $install_dir/store $install_dir/cache + ynh_exec_as_app ln -s $data_dir/store $install_dir/ + ynh_exec_as_app ln -s $data_dir/cache $install_dir/ fi #=================================================