From 32b35c026c1321f748275dbe956fab17f88805d2 Mon Sep 17 00:00:00 2001 From: Yalh Date: Fri, 11 Jan 2019 13:34:03 +0100 Subject: [PATCH] Update of backup, restore and upgrade steps --- README.md | 4 ++-- check_process | 17 ++++++++++++----- manifest.json | 6 +++--- scripts/backup | 6 +++--- scripts/remove | 1 + scripts/restore | 24 ++++++++++++++++++++---- scripts/upgrade | 32 ++++++++++++++++++++++---------- 7 files changed, 63 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 0a90d14..d1ba9ad 100644 --- a/README.md +++ b/README.md @@ -15,9 +15,9 @@ Each User can be limited from 1 to unlimited blogs. **Shipped version:** 0.70 -## Screenshots +## Licence -![](Link to an screenshot for this app) +LICENSE GPL-3.0 ## Demo diff --git a/check_process b/check_process index cb36bfd..fc65cc3 100644 --- a/check_process +++ b/check_process @@ -6,21 +6,28 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) admin="john" (USER) - language="fr" - is_public=1 (PUBLIC|public=1|private=0) password="pass" + is_public=1 (PUBLIC|public=1|private=0) + single_user="true" + site_name="WriteFreely" + site_description="WriteFreely Blogs" + open_registration="true" + max_blogs="1" + federation="true" + public_stats="true" + private="false" + local_timeline="true" ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=1 setup_public=1 upgrade=1 backup_restore=1 - multi_instance=1 + multi_instance=0 incorrect_path=1 port_already_use=0 change_url=0 diff --git a/manifest.json b/manifest.json index e0faa53..9a12a67 100644 --- a/manifest.json +++ b/manifest.json @@ -15,7 +15,7 @@ "requirements": { "yunohost": ">= 2.7.14" }, - "multi_instance": true, + "multi_instance": false, "services": [ "nginx", "mysql" @@ -85,7 +85,7 @@ "en": "Choose a description for your WriteFreely instance", "fr": "Choisissez une description pour votre instance WriteFreely" }, - "default": "WriteFreely Blogs" + "default": "WriteFreely_Blogs" }, { "name": "open_registration", @@ -102,7 +102,7 @@ "en": "How many blogs each user can create ?", "fr": "Combien de blogs chaque utilisateur peut créer ?" }, - "default": "1" + "default": "3" }, { "name": "federation", diff --git a/scripts/backup b/scripts/backup index b7448e5..63188b5 100755 --- a/scripts/backup +++ b/scripts/backup @@ -48,8 +48,8 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup "/etc/php5/fpm/pool.d/$app.conf" -ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" +#ynh_backup "/etc/php5/fpm/pool.d/$app.conf" +#ynh_backup "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # BACKUP THE MYSQL DATABASE @@ -75,4 +75,4 @@ ynh_backup "/etc/systemd/system/$app.service" # BACKUP A CRON FILE #================================================= -ynh_backup "/etc/cron.d/$app" +#ynh_backup "/etc/cron.d/$app" diff --git a/scripts/remove b/scripts/remove index 7012827..ec9d2ea 100755 --- a/scripts/remove +++ b/scripts/remove @@ -68,6 +68,7 @@ ynh_secure_remove "$final_path" # Remove the dedicated nginx config ynh_remove_nginx_config +systemctl restart nginx #================================================= # REMOVE PHP-FPM CONFIGURATION diff --git a/scripts/restore b/scripts/restore index cbb31fb..1f6387d 100755 --- a/scripts/restore +++ b/scripts/restore @@ -27,10 +27,24 @@ ynh_abort_if_errors app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) +port=$(ynh_app_setting_get $app port) path_url=$(ynh_app_setting_get $app path) +admin=$(ynh_app_setting_get $app admin) +is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) + db_name=$(ynh_app_setting_get $app db_name) +single_user=$(ynh_app_setting_get $app single_user) +site_name=$(ynh_app_setting_get $app site_name) +site_description=$(ynh_app_setting_get $app site_description) +open_registration=$(ynh_app_setting_get $app open_registration) +max_blogs=$(ynh_app_setting_get $app max_blogs) +federation=$(ynh_app_setting_get $app federation) +public_stats=$(ynh_app_setting_get $app public_stats) +private=$(ynh_app_setting_get $app private) +local_timeline=$(ynh_app_setting_get $app local_timeline) + #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= @@ -80,8 +94,8 @@ chown -R root: $final_path # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" -ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" +#ynh_restore_file "/etc/php5/fpm/pool.d/$app.conf" +#ynh_restore_file "/etc/php5/fpm/conf.d/20-$app.ini" #================================================= # SPECIFIC RESTORATION @@ -109,7 +123,7 @@ systemctl enable $app.service # RESTORE THE CRON FILE #================================================= -ynh_restore_file "/etc/cron.d/$app" +#ynh_restore_file "/etc/cron.d/$app" #================================================= # RESTORE THE LOGROTATE CONFIGURATION @@ -123,5 +137,7 @@ ynh_restore_file "/etc/logrotate.d/$app" # RELOAD NGINX AND PHP-FPM #================================================= -systemctl reload php5-fpm +#systemctl reload php5-fpm systemctl reload nginx +systemctl start "$app" + diff --git a/scripts/upgrade b/scripts/upgrade index 10598ef..9e872f1 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,12 +16,23 @@ source /usr/share/yunohost/helpers app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) +port=$(ynh_app_setting_get $app port) path_url=$(ynh_app_setting_get $app path) admin=$(ynh_app_setting_get $app admin) is_public=$(ynh_app_setting_get $app is_public) final_path=$(ynh_app_setting_get $app final_path) -language=$(ynh_app_setting_get $app language) +#language=$(ynh_app_setting_get $app language) + db_name=$(ynh_app_setting_get $app db_name) +single_user=$(ynh_app_setting_get $app single_user) +site_name=$(ynh_app_setting_get $app site_name) +site_description=$(ynh_app_setting_get $app site_description) +open_registration=$(ynh_app_setting_get $app open_registration) +max_blogs=$(ynh_app_setting_get $app max_blogs) +federation=$(ynh_app_setting_get $app federation) +public_stats=$(ynh_app_setting_get $app public_stats) +private=$(ynh_app_setting_get $app private) +local_timeline=$(ynh_app_setting_get $app local_timeline) #================================================= # ENSURE DOWNWARD COMPATIBILITY @@ -70,13 +81,6 @@ path_url=$(ynh_normalize_url_path $path_url) #================================================= # STANDARD UPGRADE STEPS -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE -#================================================= - -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" - #================================================= # NGINX CONFIGURATION #================================================= @@ -84,6 +88,13 @@ ynh_setup_source "$final_path" # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= + +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source "$final_path" + #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -102,7 +113,7 @@ ynh_system_user_create $app #================================================= # Create a dedicated php-fpm config -ynh_add_fpm_config +#ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE @@ -137,7 +148,7 @@ ynh_add_systemd_config #================================================= # Set permissions on app files -chown -R root: $final_path +chown -R $app: $final_path #================================================= # SETUP SSOWAT @@ -155,3 +166,4 @@ fi #================================================= systemctl reload nginx +systemctl start "$app"