From 7561fb4bec6580abc4bddae366539a44a53efcc1 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 11 Jan 2021 19:54:45 +0100 Subject: [PATCH 1/2] Remove ownCloud migration --- README.md | 24 --------------- README_fr.md | 25 --------------- conf/owncloud_migration | 13 -------- conf/owncloud_post_migration.sh | 45 --------------------------- scripts/upgrade | 54 --------------------------------- 5 files changed, 161 deletions(-) delete mode 100644 conf/owncloud_migration delete mode 100644 conf/owncloud_post_migration.sh diff --git a/README.md b/README.md index 3c528e5..2d6e375 100644 --- a/README.md +++ b/README.md @@ -81,30 +81,6 @@ If you need/want to use Nextcloud `occ` command¹, you need to be in `/var/www/n ¹ See https://docs.nextcloud.com/server/18/admin_manual/configuration_server/occ_command.html Use this only if you know what you're doing :) -#### Migrate from ownCloud - -**This is not considered as stable yet, please do it with care and only for testing!** - -This package handles the migration from ownCloud to Nextcloud. For that, your ownCloud application must be **up-to-date** in YunoHost. - -You will then have to upgrade your ownCloud application with this repository. This can only be done from the command-line interface - e.g. through SSH. Once you're connected, you simply have to execute the following: - -```bash -sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh owncloud --debug -``` - -The `--debug` option will let you see the full output. If you encounter any -issue, please paste it. - -Note that a cron job will be executed at some time after the end of this command. You must wait that before doing any other application operations! You should see that Nextcloud is installed after that. - -Note that it does not change the application label nor the URL. To rename the label, you can execute the following - replace `Nextcloud` with whatever you want: - -```bash -sudo yunohost app setting nextcloud label -v "Nextcloud" -sudo yunohost app ssowatconf -``` - ## Links * Report a bug: https://github.com/YunoHost-Apps/nextcloud_ynh/issues diff --git a/README_fr.md b/README_fr.md index baf3cdd..0b4b066 100644 --- a/README_fr.md +++ b/README_fr.md @@ -72,31 +72,6 @@ Et enfin, le message d'erreur suivant dans les logs de Nextcloud peut être igno Following symlinks is not allowed ('/home/yunohost.multimedia/user/Share' -> '/home/yunohost.multimedia/share/' not inside '/home/yunohost.multimedia/user/') ``` -## Informations supplémentaires - -#### Migrer depuis ownCloud - -**La migration n'est pas encore considérée comme stable, merci de la faire prudemment et uniquement pour tester !** - -Ce package gère la migration de ownCloud vers Nextcloud. Pour ça, l'application ownCloud doit **être à jour** dans YunoHost. - -Vous allez ensuite mettre à niveau votre ownCloud avec ce dépôt. -Ça ne peut être fait qu'en ligne de commande - par exemple via SSH. Une fois connecté, vous n'avez plus qu'à exécuter la commande suivante : -```bash -sudo yunohost app upgrade -u https://github.com/YunoHost-Apps/nextcloud_ynh owncloud --debug -``` - -L'option `--debug` va vous permettre de visualiser entièrement les retours de la mise à niveau. Si vous rencontrez un problème, merci de nous le transmettre. - -Notez qu'une tâche cron va être exécutée une fois la fin de cette commande. Vous devez attendre qu'elle se fasse avant de faire une autre opération liée aux applications. -Vous devriez constater que Nextcloud sera installé après ça. - -Notez que ça ne changera pas le label ni l'URL. Pour renommer le label, vous pouvez exécuter la commande suivante (en remplaçant `Nextcloud` par ce que vous voulez) : -```bash -sudo yunohost app setting nextcloud label -v "Nextcloud" -sudo yunohost app ssowatconf -``` - ## Liens * Signaler un bug : https://github.com/YunoHost-Apps/nextcloud_ynh/issues diff --git a/conf/owncloud_migration b/conf/owncloud_migration deleted file mode 100644 index 4c1be85..0000000 --- a/conf/owncloud_migration +++ /dev/null @@ -1,13 +0,0 @@ -# File to migrate from Owncloud - -# Final path -/var/www/$app - -# Data directory -/home/yunohost.app/$app - -# Nginx config -/etc/nginx/conf.d/$domain.d/$app.conf - -# php-fpm config -/etc/php5/fpm/pool.d/$app.conf diff --git a/conf/owncloud_post_migration.sh b/conf/owncloud_post_migration.sh deleted file mode 100644 index 952baac..0000000 --- a/conf/owncloud_post_migration.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -# Ending the migration process from Owncloud to Nextcloud - -set -u - -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - -source /usr/share/yunohost/helpers - -#================================================= -# SET VARIABLES -#================================================= - -old_app="__OLD_APP__" -new_app="__NEW_APP__" -script_name="$0" - -#================================================= -# MOVE HOOKS -#================================================= - -hooks_dir="/etc/yunohost/hooks.d/" -mv "$hooks_dir/post_user_create/50-$old_app" "$hooks_dir/post_user_create/50-$new_app" - -#================================================= -# DELETE OLD APP'S SETTINGS -#================================================= - -ynh_secure_remove "/etc/yunohost/apps/$old_app" -yunohost app ssowatconf - -#================================================= -# REMOVE THE OLD USER -#================================================= - -ynh_system_user_delete $old_app - -#================================================= -# DELETE THIS SCRIPT -#================================================= - -echo "rm $script_name" | at now + 1 minutes diff --git a/scripts/upgrade b/scripts/upgrade index 18e0b49..ba025f6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -87,44 +87,11 @@ then # Remove the option backup_core_only after the backup. ynh_app_setting_delete $app backup_core_only - - ynh_clean_setup () { - # Remove the post migration script before its execution ! - ynh_exec_warn_less ynh_secure_remove --file="/tmp/owncloud_post_migration.sh" - - # restore it if the upgrade fails - ynh_restore_upgradebackup - } fi # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# HANDLE MIGRATION FROM OWNCLOUD -#================================================= - -ynh_handle_app_migration "owncloud" "owncloud_migration" -if [ $migration_process -eq 1 ] -then - # If a migration has been performed - # Reload some values changed by the migration process - final_path=$(ynh_app_setting_get --app=$app --key=final_path) - db_name=$(ynh_app_setting_get --app=$app --key=db_name) - - # Remove the old fake package for owncloud. - # Its name is specific, so the migration process can't remove it - ynh_package_autopurge owncloud-deps - - # Change the database access in the config - ynh_replace_string "\('dbname' =>\).*" "\1 '$db_name'," "$final_path/config/config.php" - ynh_replace_string "\('dbuser' =>\).*" "\1 '$db_name'," "$final_path/config/config.php" - - # Change the path of the data directory - ynh_replace_string "\('dbuser' =>\).*" "\1 '$db_name'," "$final_path/config/config.php" - ynh_replace_string "\('datadirectory' =>.*\)$old_app" "\1$app" "$final_path/config/config.php" -fi - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -501,27 +468,6 @@ ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name="php${phpversion}-fpm" --action=reload -#================================================= -# FINISH MIGRATION PROCESS -#================================================= - -if [ $migration_process -eq 1 ] -then - ynh_print_info --message="ownCloud has been successfully migrated to Nextcloud! \ -A last scheduled operation will run in a couple of minutes to finish the \ -migration in YunoHost side. Do not proceed any application operation while \ -you don't see Nextcloud as installed." - - # Execute a post migration script after the end of this upgrade. - # Mainly for some cleaning - script_post_migration=owncloud_post_migration.sh - ynh_replace_string --match_string="__OLD_APP__" --replace_string="$old_app" --target_file=../conf/$script_post_migration - ynh_replace_string --match_string="__NEW_APP__" --replace_string="$app" --target_file=../conf/$script_post_migration - cp ../conf/$script_post_migration /tmp - chmod +x /tmp/$script_post_migration - (cd /tmp; echo "/tmp/$script_post_migration > /tmp/$script_post_migration.log 2>&1" | at now + 2 minutes) -fi - #================================================= # END OF SCRIPT #================================================= From 6d041fda5f1d43c749b307fbe0d3698eb0b100f8 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 16 Jan 2021 14:12:15 +0100 Subject: [PATCH 2/2] Put back ynh_clean_setup --- scripts/upgrade | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/upgrade b/scripts/upgrade index ba025f6..24cfe02 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -87,6 +87,11 @@ then # Remove the option backup_core_only after the backup. ynh_app_setting_delete $app backup_core_only + + ynh_clean_setup () { + # restore it if the upgrade fails + ynh_restore_upgradebackup + } fi # Exit if an error occurs during the execution of the script