From 940f011a6b815715c9034d1a5c6ac394e68be3ed Mon Sep 17 00:00:00 2001 From: Xavier Brochard Date: Thu, 5 Aug 2021 18:25:31 +0200 Subject: [PATCH 1/4] explique le compte admin --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fb37048..a0c9be2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to * Pas de mise à jour automatique depuis l'ancien package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh) * Application en français uniquement -* Ne fonctionne pas avec le SSO (comptes admin/utilisateurs séparés). +* Ne fonctionne pas avec le SSO (comptes admin/utilisateurs séparés), connectez-vous avec le compte "admin" et le mot de passe que vous aurez défini pour créer les utilisateurs. ## Additionnal informations From 052e14ba3c10aec52823a9e261ee82b5b16d7b87 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 14 Nov 2021 17:06:44 +0000 Subject: [PATCH 2/4] Auto-update README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f222992..3c0b382 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ Monitors French classifieds websites LeBonCoin and SeLoger ## Limitations -* Pas de mise à jour automatique depuis l'ancien package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh) -* Application en français uniquement -* Ne fonctionne pas avec le SSO (comptes admin/utilisateurs séparés), connectez-vous avec le compte "admin" et le mot de passe que vous aurez défini pour créer les utilisateurs. +* No automatic update from the old package [LBCAlerte](https://github.com/YunoHost-Apps/LBCAlerte_ynh) +* Application in French only +* Does not work with SSO (separate admin / user accounts). ## Documentation and resources From 602ab776d5bdf2bf46473336d5efc186b41916b7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 6 Mar 2022 20:42:40 +0100 Subject: [PATCH 3/4] Apply last example_ynh --- check_process | 3 ++- manifest.json | 10 +++++----- scripts/_common.sh | 8 ++++++-- scripts/backup | 24 +++++++++++++++--------- scripts/install | 17 ++++++++++------- scripts/remove | 25 +++++++++++++------------ scripts/upgrade | 26 ++++++++++++++++---------- 7 files changed, 67 insertions(+), 46 deletions(-) diff --git a/check_process b/check_process index 051ed3f..d7d0362 100644 --- a/check_process +++ b/check_process @@ -3,7 +3,7 @@ domain="domain.tld" path="/path" is_public=1 - password="password" + password="1Strong-Password" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -15,6 +15,7 @@ upgrade=1 from_commit=ee9a1c83c800c4bf269a8c798468aaaeb3a9accb backup_restore=1 multi_instance=1 + port_already_use=0 change_url=0 ;;; Options Email= diff --git a/manifest.json b/manifest.json index b6d0a1a..6a40208 100644 --- a/manifest.json +++ b/manifest.json @@ -32,7 +32,7 @@ } ], "requirements": { - "yunohost": ">= 4.2.4" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ @@ -52,14 +52,14 @@ "example": "/cheky", "default": "/cheky" }, - { - "name": "password", - "type": "password" - }, { "name": "is_public", "type": "boolean", "default": true + }, + { + "name": "password", + "type": "password" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index af0224b..d7614e9 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,11 +1,15 @@ #!/bin/bash +#================================================= +# COMMON VARIABLES +#================================================= + +YNH_PHP_VERSION="7.3" + #================================================= # PERSONAL HELPERS #================================================= -YNH_PHP_VERSION="7.3" - #================================================= # EXPERIMENTAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 0dbb3dd..89da2d0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -6,6 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,13 +14,16 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + true +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -52,20 +56,22 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= -# BACKUP THE MYSQL DATABASE +# SPECIFIC BACKUP #================================================= -ynh_print_info "Backing up the MySQL database..." - -ynh_mysql_dump_db --database="$db_name" > db.sql - -#================================================= -# BACKUP A CRON FILE +# BACKUP VARIOUS FILES #================================================= ynh_backup --src_path="/etc/cron.d/$app" +#================================================= +# BACKUP THE MYSQL DATABASE +#================================================= +ynh_print_info --message="Backing up the MySQL database..." + +ynh_mysql_dump_db --database="$db_name" > db.sql + #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 99bce2b..5c13346 100644 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -22,8 +25,8 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -password=$YNH_APP_ARG_PASSWORD is_public=$YNH_APP_ARG_IS_PUBLIC +password=$YNH_APP_ARG_PASSWORD app=$YNH_APP_INSTANCE_NAME @@ -83,7 +86,7 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -91,7 +94,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config #================================================= @@ -108,12 +111,10 @@ chmod 644 "/etc/cron.d/$app" #================================================= # SETUP APPLICATION WITH CURL #================================================= - -# Set right permissions for curl install -chown -R $app $final_path +ynh_script_progression --message="Setuping application with CURL..." # Set the app as temporarily public for curl call -ynh_script_progression --message="Configuring permissions..." +ynh_script_progression --message="Configuring SSOwat..." # Making the app public for curl ynh_permission_update --permission="main" --add="visitors" @@ -137,6 +138,8 @@ ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] then + # Everyone can access the app. + # The "main" permission is automatically created before the install script. ynh_permission_update --permission="main" --add="visitors" fi diff --git a/scripts/remove b/scripts/remove index a095f2d..109f130 100644 --- a/scripts/remove +++ b/scripts/remove @@ -16,25 +16,25 @@ ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get --app=$app --key=domain) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name -final_path=$(ynh_app_setting_get $app final_path) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # STANDARD REMOVE #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database" +ynh_script_progression --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user -ynh_mysql_remove_db $db_user $db_name +ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory" +ynh_script_progression --message="Removing app main directory..." # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -42,24 +42,25 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration" +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing PHP-FPM configuration" +ynh_script_progression --message="Removing PHP-FPM configuration..." -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= # SPECIFIC REMOVE #================================================= -# REMOVE THE CRON FILE +# REMOVE VARIOUS FILES #================================================= +ynh_script_progression --message="Removing various files..." # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" @@ -69,7 +70,7 @@ ynh_secure_remove --file="/etc/cron.d/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user..." # Delete a system user ynh_system_user_delete --username=$app diff --git a/scripts/upgrade b/scripts/upgrade index 572b51a..3978a89 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,33 +16,37 @@ ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -admin=$(ynh_app_setting_get $app admin) -final_path=$(ynh_app_setting_get $app final_path) -db_name=$(ynh_app_setting_get $app db_name) +domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) +admin=$(ynh_app_setting_get --app=$app --key=admin) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION #================================================= +ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# STANDARD UPGRADE STEPS #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= @@ -75,8 +79,6 @@ ynh_script_progression --message="Making sure dedicated system user exists..." - # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" -#================================================= -# STANDARD UPGRADE STEPS #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -98,7 +100,7 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -106,18 +108,22 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= +# ... +#================================================= ynh_script_progression --message="Running specific upgrade..." --weight=1 # Copy Yunohost custom script to cheky folder and launch it cp yunohost_upgrade_cheky.php $final_path/others/update/ ynh_exec_as "$app" /usr/bin/php$phpversion $final_path/others/update/yunohost_upgrade_cheky.php $final_path +#================================================= +# GENERIC FINALIZATION #================================================= # RELOAD NGINX #================================================= From 1513a3f09ad7dd48b0f64b22f5c34664c473e1d3 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 8 Mar 2022 20:18:33 +0100 Subject: [PATCH 4/4] disable database upgrade won't work as http://releases.cheky.net/releases.php no more exist --- scripts/upgrade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 3978a89..b9375aa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -120,7 +120,8 @@ ynh_script_progression --message="Running specific upgrade..." --weight=1 # Copy Yunohost custom script to cheky folder and launch it cp yunohost_upgrade_cheky.php $final_path/others/update/ -ynh_exec_as "$app" /usr/bin/php$phpversion $final_path/others/update/yunohost_upgrade_cheky.php $final_path +# Upgrade disable because http://releases.cheky.net/releases.php no more exist +#ynh_exec_as "$app" /usr/bin/php$phpversion $final_path/others/update/yunohost_upgrade_cheky.php $final_path #================================================= # GENERIC FINALIZATION