From f2233f7b9ea5013e7e1a985eea82a9b415029e8a Mon Sep 17 00:00:00 2001 From: Plumf Date: Tue, 5 May 2020 12:38:08 +0200 Subject: [PATCH 1/6] Fix time & weight --- scripts/backup | 2 +- scripts/change_url | 2 +- scripts/install | 35 +---------------------------------- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 32 ++++++++++---------------------- 6 files changed, 15 insertions(+), 60 deletions(-) diff --git a/scripts/backup b/scripts/backup index b4f337e..3a4dc1c 100755 --- a/scripts/backup +++ b/scripts/backup @@ -66,4 +66,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last diff --git a/scripts/change_url b/scripts/change_url index f1a2993..7b9de19 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -117,4 +117,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression --message="Change of URL completed for $app" --time --last diff --git a/scripts/install b/scripts/install index ce27c76..500b1d2 100755 --- a/scripts/install +++ b/scripts/install @@ -143,35 +143,15 @@ ynh_system_user_create --username=$app #================================================= ynh_script_progression --message="Configuring php-fpm..." --weight=40 -### `ynh_add_fpm_config` is used to set up a PHP config. -### You can remove it if your app doesn't use PHP. -### `ynh_add_fpm_config` will use the files conf/php-fpm.conf -### If you're not using these lines: -### - You can remove these files in conf/. -### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script -### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script -### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script -### With the reload at the end of the script. -### - And the section "PHP-FPM CONFIGURATION" in the upgrade script - # Create a dedicated php-fpm config ynh_add_fpm_config #================================================= # SPECIFIC SETUP -#================================================= -# ... -#================================================= - #================================================= # SETUP APPLICATION WITH CURL #================================================= -### Use these lines only if the app installation needs to be finalized through -### web forms. We generally don't want to ask the final user, -### so we're going to use curl to automatically fill the fields and submit the -### forms. - # Set right permissions for curl install chown -R $app: $final_path @@ -199,25 +179,12 @@ then ynh_app_setting_delete --app=$app --key=skipped_uris fi -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -### `ynh_replace_string` is used to replace a string in a file. -### (It's compatible with sed regular expressions syntax) - -#####ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE" - #================================================= # GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - # Set permissions to app files chown -R root: $final_path chown -R $app $final_path/{cache,files,themes,tools,wakka.config.php} @@ -245,4 +212,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression --message="Installation of $app completed" --time --last diff --git a/scripts/remove b/scripts/remove index b55d9b2..c45e8a9 100755 --- a/scripts/remove +++ b/scripts/remove @@ -82,4 +82,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression --message="Removal of $app completed" --time --last diff --git a/scripts/restore b/scripts/restore index ada073f..026a19b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -113,4 +113,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression --message="Restoration completed for $app" --time --last diff --git a/scripts/upgrade b/scripts/upgrade index 96eaabd..eea48c6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -39,7 +39,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --time --weight=1 +ynh_script_progression --message="Ensuring downward compatibility..." --weight=4 # Fix is_public as a boolean value if [ "$is_public" = "Yes" ]; then @@ -65,7 +65,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=5 # Backup the current version of the app ynh_backup_before_upgrade @@ -76,18 +76,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors -#================================================= -# CHECK THE PATH -#================================================= - -# Normalize the URL path syntax -# N.B. : this is for app installations before YunoHost 2.7 -# where this value might be something like /foo/ or foo/ -# instead of /foo .... -# If nobody installed your app before 2.7, then you may -# safely remove this line -path_url=$(ynh_normalize_url_path --path_url=$path_url) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -96,7 +84,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url) if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --time --weight=1 + ynh_script_progression --message="Upgrading source files..." --weight=13 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" @@ -105,7 +93,7 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=15 # Create a dedicated nginx config ynh_add_nginx_config @@ -113,14 +101,14 @@ ynh_add_nginx_config #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading dependencies..." --time --weight=1 +ynh_script_progression --message="Upgrading dependencies..." --weight=17 ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." --time --weight=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=25 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app @@ -128,7 +116,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=26 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -161,7 +149,7 @@ chown -R root: $final_path #================================================= # SETUP SSOWAT #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." --time --weight=1 +ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=29 # Make app public if necessary if [ $is_public -eq 1 ] @@ -173,7 +161,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server..." --weight=31 ynh_systemd_action --service_name=nginx --action=reload From 040e896cd9ce82a62001579396b793bfd009a99e Mon Sep 17 00:00:00 2001 From: Plumf Date: Tue, 5 May 2020 13:20:50 +0200 Subject: [PATCH 2/6] Fix Time & Weight --- scripts/backup | 2 +- scripts/change_url | 2 +- scripts/install | 2 +- scripts/remove | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/backup b/scripts/backup index 3a4dc1c..b4f337e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -66,4 +66,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --time --last +ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last diff --git a/scripts/change_url b/scripts/change_url index 7b9de19..489f138 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -117,4 +117,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 500b1d2..0bc7f6b 100755 --- a/scripts/install +++ b/scripts/install @@ -212,4 +212,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index c45e8a9..b55d9b2 100755 --- a/scripts/remove +++ b/scripts/remove @@ -82,4 +82,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --time --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 026a19b..ada073f 100755 --- a/scripts/restore +++ b/scripts/restore @@ -113,4 +113,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --time --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index eea48c6..2bfa8e4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -169,4 +169,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --time --last +ynh_script_progression --message="Upgrade of $app completed" --last From 06c99463dd86e85a9a01bf3ec991b5b2b2eb66c3 Mon Sep 17 00:00:00 2001 From: Plumf Date: Tue, 5 May 2020 23:49:23 +0200 Subject: [PATCH 3/6] Fix Rules Groups and users --- scripts/install | 14 +++++++------- scripts/upgrade | 25 +++++-------------------- 2 files changed, 12 insertions(+), 27 deletions(-) diff --git a/scripts/install b/scripts/install index 0bc7f6b..e135183 100755 --- a/scripts/install +++ b/scripts/install @@ -157,7 +157,7 @@ chown -R $app: $final_path # Set the app as temporarily public for curl call ynh_script_progression --message="Configuring SSOwat..." --weight=42 -ynh_app_setting_set --app=$app --key=skipped_uris --value="/" +ynh_permission_update --permission main --remove all_users --add visitors # Reload SSOwat config yunohost app ssowatconf @@ -176,7 +176,7 @@ ynh_local_curl "/?PagePrincipale&installAction=install" "config[default_language # Remove the public access if [ $is_public -eq 0 ] then - ynh_app_setting_delete --app=$app --key=skipped_uris + ynh_permission_update --permission main --remove visitors --add all_users fi #================================================= @@ -185,7 +185,7 @@ fi # SECURE FILES AND DIRECTORIES #================================================= -# Set permissions to app files +# Set permissions to app files chown -R root: $final_path chown -R $app $final_path/{cache,files,themes,tools,wakka.config.php} @@ -195,11 +195,11 @@ chown -R $app $final_path/{cache,files,themes,tools,wakka.config.php} ynh_script_progression --message="Configuring SSOwat..." --weight=47 # Make app public if necessary -if [ $is_public -eq 1 ] -then +#if [ $is_public -eq 1 ] +#then - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi +# ynh_permission_update --permission main --add visitors +#fi #================================================= # RELOAD NGINX diff --git a/scripts/upgrade b/scripts/upgrade index 2bfa8e4..b7ffecf 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -121,22 +121,6 @@ ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2 # Create a dedicated php-fpm config ynh_add_fpm_config -#================================================= -# SPECIFIC UPGRADE -#================================================= -# ... -#================================================= - -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= - -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -#####ynh_backup_if_checksum_is_different --file="$final_path/CONFIG_FILE" -# Recalculate and store the checksum of the file for the next upgrade. -#####ynh_store_file_checksum --file="$final_path/CONFIG_FILE" - #================================================= # GENERIC FINALIZATION #================================================= @@ -145,6 +129,7 @@ ynh_add_fpm_config # Set permissions on app files chown -R root: $final_path +chown -R $app $final_path/{cache,files,themes,tools,wakka.config.php} #================================================= # SETUP SSOWAT @@ -152,11 +137,11 @@ chown -R root: $final_path ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=29 # Make app public if necessary -if [ $is_public -eq 1 ] -then +#if [ $is_public -eq 1 ] +#then # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi + #ynh_permission_update --permission main --remove all_users --add visitors +#fi #================================================= # RELOAD NGINX From b0e6a88739ad87474c1832b3a98251e451dde96b Mon Sep 17 00:00:00 2001 From: Plumf Date: Wed, 6 May 2020 10:35:58 +0200 Subject: [PATCH 4/6] Fix check_process --- check_process | 2 +- scripts/change_url | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/check_process b/check_process index ffd1a7c..9e0b364 100644 --- a/check_process +++ b/check_process @@ -27,7 +27,7 @@ upgrade=0 from_commit=65c382d138596fcb32b4c97c39398815a1dcd4e8 backup_restore=1 multi_instance=1 - port_already_use=0 (66) + port_already_use=1 (66) change_url=0 actions=0 config_panel=0 diff --git a/scripts/change_url b/scripts/change_url index 489f138..b594211 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -91,11 +91,11 @@ fi # Change the domain for nginx if [ $change_domain -eq 1 ] then - # Delete file checksum for the old conf file location - #ynh_delete_file_checksum --file="$nginx_conf_path" + # Delete file checksum for the old conf file location + ynh_delete_file_checksum --file="$nginx_conf_path" mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf - # Store file checksum for the new config file location - #ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + # Store file checksum for the new config file location + ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi #================================================= From 26979267eefb10853b125eea6c599bfd4df16949 Mon Sep 17 00:00:00 2001 From: Plumf Date: Wed, 6 May 2020 10:36:48 +0200 Subject: [PATCH 5/6] Fix Manifest --- manifest.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index 531557f..912f23b 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "yeswiki", "packaging_format": 1, "description": { - "en": "$app is free software born from the cross-fertilization of the discussions and know-how of developers and facilitators of cooperative projects.", - "fr": "$app est un logiciel libre né du croisement des discussions et savoir-faire de développeurs et animateurs de projets coopératifs." + "en": "YesWiki is a wiki that is quick and easy to use, with a nice design and a French-speaking support community.", + "fr": "YesWiki est wiki facile et rapide à prendre en main, avec un design agréable et une communauté d'entraide francophone." }, "version": "1.0~ynh1", "url": "https://yeswiki.net/", @@ -12,7 +12,7 @@ "maintainer": { "name": "Plumf", "email": "plumf@open-plug.eu", - "url": "http://plumf.eu" + "url": "https://plumf.eu" }, "requirements": { "yunohost": ">= 3.7.0" @@ -62,8 +62,8 @@ }, "default": true, "help": { - "en": "If $app is made public anyone will be able to view the wiki", - "fr": "Si $app est rendu publique toute personne pourra consulter le wiki" + "en": "If YesWiki is made public anyone will be able to view the wiki", + "fr": "Si YesWiki est rendu publique toute personne pourra consulter le wiki" } }, @@ -74,7 +74,7 @@ "en": "Choose the application language", "fr": "Choisissez la langue de l'application" }, - "choices": ["fr", "en"], + "choices": ["fr", "en", "ca", "es", "nl", "pt"], "default": "fr" }, { From 8b24c70b866fb49e7c533c1c695d926434b7d56c Mon Sep 17 00:00:00 2001 From: Plumf Date: Wed, 6 May 2020 10:56:40 +0200 Subject: [PATCH 6/6] add ~ynh version --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 912f23b..70d83c1 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "YesWiki is a wiki that is quick and easy to use, with a nice design and a French-speaking support community.", "fr": "YesWiki est wiki facile et rapide à prendre en main, avec un design agréable et une communauté d'entraide francophone." }, - "version": "1.0~ynh1", + "version": "1.0~ynh2", "url": "https://yeswiki.net/", "license": "free", "maintainer": {