From 5e3c21f542781d8324e49d4f493da65decbc947f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 09:12:22 +0200 Subject: [PATCH 01/10] Fix --- check_process | 28 +++++----------------------- manifest.json | 16 ++-------------- scripts/install | 21 +-------------------- scripts/restore | 2 +- scripts/upgrade | 41 +++++++---------------------------------- 5 files changed, 16 insertions(+), 92 deletions(-) diff --git a/check_process b/check_process index 5d0c888..ae7a65f 100644 --- a/check_process +++ b/check_process @@ -1,17 +1,12 @@ -# See here for more informations -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/path" (PATH) - admin="john" (USER) + domain="domain.tld" + path="/path" + admin="john" #language="fr" - is_public=1 (PUBLIC|public=1|private=0) + is_public=1 password="pass" - #port="666" (PORT) + #port="666" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -26,19 +21,6 @@ incorrect_path=1 port_already_use=0 change_url=0 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: - Level 4=0 -# Level 5: - Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=none diff --git a/manifest.json b/manifest.json index bee0e8e..2a25012 100644 --- a/manifest.json +++ b/manifest.json @@ -27,12 +27,12 @@ } ], "requirements": { - "yunohost": ">= 3.4" + "yunohost": ">= 4.2.0" }, "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql" ], "arguments": { @@ -40,29 +40,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Cheky", - "fr": "Choisissez un nom de domaine pour Cheky" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Cheky", - "fr": "Choisissez un chemin pour Cheky" - }, "example": "/cheky", "default": "/cheky" }, { "name": "password", "type": "password", - "ask": { - "en": "Password for admin account", - "fr": "Mot de passe compte admin" - }, "example": "password" }, { diff --git a/scripts/install b/scripts/install index b31177e..31e0bed 100644 --- a/scripts/install +++ b/scripts/install @@ -25,16 +25,6 @@ path_url=$YNH_APP_ARG_PATH password=$YNH_APP_ARG_PASSWORD is_public=$YNH_APP_ARG_IS_PUBLIC -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= @@ -59,19 +49,12 @@ ynh_print_info "Storing installation settings..." ynh_app_setting_set $app domain $domain ynh_app_setting_set $app path $path_url ynh_app_setting_set $app password $password -ynh_app_setting_set $app is_public $is_public - #================================================= # CREATE A MYSQL DATABASE #================================================= ynh_print_info "Creating a MySQL database..." -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd - db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name ynh_mysql_setup_db $db_name $db_name @@ -130,7 +113,6 @@ chmod 644 "$cron_path" ynh_replace_string "__USER__" "$app" "$cron_path" ynh_replace_string "__FINALPATH__" "$final_path" "$cron_path" - #================================================= # SETUP APPLICATION WITH CURL #================================================= @@ -180,8 +162,7 @@ ynh_print_info "Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set $app unprotected_uris "/" + ynh_permission_update --permission="main" --add="visitors" fi #================================================= diff --git a/scripts/restore b/scripts/restore index 9e8d8ca..7441ba8 100644 --- a/scripts/restore +++ b/scripts/restore @@ -97,7 +97,7 @@ ynh_restore_file "/etc/cron.d/$app" #================================================= ynh_print_info "Reloading nginx web server and php-fpm..." -systemctl reload php7.0-fpm +systemctl reload php7.3-fpm systemctl reload nginx #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2146ddb..8251efa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,6 @@ 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) -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) @@ -28,15 +27,6 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= ynh_print_info "Ensuring downward compatibility..." -# Fix is_public as a boolean value -if [ "$is_public" = "Yes" ]; then - ynh_app_setting_set $app is_public 1 - is_public=1 -elif [ "$is_public" = "No" ]; then - ynh_app_setting_set $app is_public 0 - is_public=0 -fi - # If db_name doesn't exist, create it if [ -z $db_name ]; then db_name=$(ynh_sanitize_dbid $app) @@ -49,6 +39,13 @@ if [ -z $final_path ]; then ynh_app_setting_set $app final_path $final_path fi +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -63,13 +60,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 -path_url=$(ynh_normalize_url_path $path_url) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -109,11 +99,6 @@ ynh_add_fpm_config #================================================= ynh_print_info "Running specific upgrade..." -# Needed so no manual operation has to be done by user while upgrading -# If missing, Cheky is stuck in an "upgrade" state and the config file -# needs to be edited with latest version -# Also avoid to make file "$final_path/version.php" writable - # Give full access to "$app" so php script can do "its own magic stuff" chown -R $app: $final_path @@ -134,18 +119,6 @@ chown -R root: $final_path chown -R $app: $final_path/var # requirement in official documentation chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sauvegardées" tab -#================================================= -# SETUP SSOWAT -#================================================= -ynh_print_info "Upgrading SSOwat configuration..." - -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set $app unprotected_uris "/" -fi - #================================================= # RELOAD NGINX #================================================= From e893c91b41775b8d4b4cc8038877a479e80351ec Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 09:44:10 +0200 Subject: [PATCH 02/10] Fix --- check_process | 4 ---- conf/cheky.cron | 2 +- conf/nginx.conf | 5 ++--- conf/php-fpm.conf | 32 ++++++++++++++++---------------- manifest.json | 4 ++-- scripts/_common.sh | 16 ++-------------- scripts/backup | 17 ++++++----------- scripts/install | 12 ++++-------- scripts/restore | 22 ++++++++++++---------- scripts/upgrade | 22 +++++++++++----------- 10 files changed, 56 insertions(+), 80 deletions(-) diff --git a/check_process b/check_process index ae7a65f..8a4c77d 100644 --- a/check_process +++ b/check_process @@ -3,10 +3,8 @@ domain="domain.tld" path="/path" admin="john" - #language="fr" is_public=1 password="pass" - #port="666" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -18,8 +16,6 @@ upgrade=1 from_commit=a6b2615101887e3235aab0b95607eb1b58507a4c backup_restore=1 multi_instance=1 - incorrect_path=1 - port_already_use=0 change_url=0 ;;; Options Email= diff --git a/conf/cheky.cron b/conf/cheky.cron index cf1909d..06aeb65 100644 --- a/conf/cheky.cron +++ b/conf/cheky.cron @@ -1 +1 @@ -*/5 * * * * __USER__ /usr/bin/php -f __FINALPATH__/check.php +*/5 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINALPATH__/check.php diff --git a/conf/nginx.conf b/conf/nginx.conf index 8ae6307..02ab5bc 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -9,7 +9,6 @@ location __PATH__/ { rewrite ^ https://$server_name$request_uri? permanent; } -### Example PHP configuration (remove it if not used) index index.php; # Common parameter to increase upload size limit in conjuction with dedicated php-fpm file @@ -18,7 +17,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php5-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; @@ -26,7 +25,7 @@ location __PATH__/ { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } -### End of PHP configuration part + # Very important security restriction # See https://forum.cheky.net/information-sur-message-avertissement-securite-t553-p1.html#p2127 diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index 9018c9d..ab1a471 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -33,7 +33,7 @@ group = __USER__ ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) @@ -41,7 +41,7 @@ listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock ; Set permissions for unix socket, if one is used. In Linux, read/write ; permissions must be set in order to allow connections from a web server. Many -; BSD-derived systems allow connections regardless of permissions. +; BSD-derived systems allow connections regardless of permissions. ; Default Values: user and group are set as the running user ; mode is set to 0660 listen.owner = www-data @@ -131,7 +131,7 @@ pm.max_spare_servers = 3 ; Note: Used only when pm is set to 'ondemand' ; Default Value: 10s ;pm.process_idle_timeout = 10s; - + ; The number of requests each child process should execute before respawning. ; This can be useful to work around memory leaks in 3rd party libraries. For ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS. @@ -184,7 +184,7 @@ pm.max_spare_servers = 3 ; ; By default the status page only outputs short status. Passing 'full' in the ; query string will also return status for each pool process. -; Example: +; Example: ; http://www.foo.bar/status?full ; http://www.foo.bar/status?json&full ; http://www.foo.bar/status?html&full @@ -297,7 +297,7 @@ pm.max_spare_servers = 3 ; - .... ; %p: PID of the child that serviced the request ; %P: PID of the parent of the child that serviced the request -; %q: the query string +; %q: the query string ; %Q: the '?' character if query string exists ; %r: the request URI (without the query string, see %q and %Q) ; %R: remote IP address @@ -316,40 +316,40 @@ pm.max_spare_servers = 3 ; ; Default: "%R - %u %t \"%m %r\" %s" ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%" - + ; The log file for slow requests ; Default Value: not set ; Note: slowlog is mandatory if request_slowlog_timeout is set -slowlog = /var/log/nginx/__NAMETOCHANGE__.slow.log - +;slowlog = log/$pool.log.slow + ; The timeout for serving a single request after which a PHP backtrace will be ; dumped to the 'slowlog' file. A value of '0s' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 -request_slowlog_timeout = 5s - +;request_slowlog_timeout = 0 + ; The timeout for serving a single request after which the worker process will ; be killed. This option should be used when the 'max_execution_time' ini option ; does not stop script execution for some reason. A value of '0' means 'off'. ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays) ; Default Value: 0 request_terminate_timeout = 1d - + ; Set open file descriptor rlimit. ; Default Value: system defined value ;rlimit_files = 1024 - + ; Set max core size rlimit. ; Possible Values: 'unlimited' or an integer greater or equal to 0 ; Default Value: system defined value ;rlimit_core = 0 - + ; Chroot to this directory at the start. This value must be defined as an ; absolute path. When this value is not set, chroot is not used. ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one ; of its subdirectories. If the pool prefix is not set, the global prefix ; will be used instead. -; Note: chrooting is a great security feature and should be used whenever +; Note: chrooting is a great security feature and should be used whenever ; possible. However, all PHP paths will be relative to the chroot ; (error_log, sessions.save_path, ...). ; Default Value: not set @@ -383,7 +383,7 @@ chdir = __FINALPATH__ ; Note: set an empty value to allow all extensions. ; Default Value: .php ;security.limit_extensions = .php .php3 .php4 .php5 .php7 - + ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from ; the current environment. ; Default Value: clean env @@ -397,7 +397,7 @@ chdir = __FINALPATH__ ; overwrite the values previously defined in the php.ini. The directives are the ; same as the PHP SAPI: ; php_value/php_flag - you can set classic ini defines which can -; be overwritten from PHP call 'ini_set'. +; be overwritten from PHP call 'ini_set'. ; php_admin_value/php_admin_flag - these directives won't be overwritten by ; PHP call 'ini_set' ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no. diff --git a/manifest.json b/manifest.json index 2a25012..3f180cc 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "cheky", "packaging_format": 1, "description": { - "en": "Cheky monitors French classifieds websites LeBonCoin and SeLoger.", - "fr": "Cheky surveille pour vous LeBonCoin et SeLoger." + "en": "Monitors French classifieds websites LeBonCoin and SeLoger.", + "fr": "Surveille pour vous LeBonCoin et SeLoger." }, "version": "4.4.1~ynh4", "url": "https://www.cheky.net", diff --git a/scripts/_common.sh b/scripts/_common.sh index c85fc0e..af0224b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,24 +4,12 @@ # PERSONAL HELPERS #================================================= +YNH_PHP_VERSION="7.3" + #================================================= # EXPERIMENTAL HELPERS #================================================= -# Execute a command as another user -# usage: exec_as USER COMMAND [ARG ...] -# Source : https://github.com/YunoHost-Apps/Experimental_helpers/tree/master/ynh_exec_as -exec_as() { - local USER=$1 - shift 1 - - if [[ $USER = $(whoami) ]]; then - eval "$@" - else - sudo -u "$USER" "$@" - fi -} - #================================================= # FUTURE OFFICIAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index bea564c..9f6005d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -26,29 +26,30 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get $app final_path) domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= -# STANDARD BACKUP STEPS +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +ynh_print_info --message="Declaring files to be backed up..." + #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_print_info "Backing up the main app directory..." ynh_backup "$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_print_info "Backing up nginx web server configuration..." ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Backing up php-fpm configuration..." -ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_backup "/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE @@ -57,12 +58,6 @@ ynh_print_info "Backing up the MySQL database..." ynh_mysql_dump_db "$db_name" > db.sql -#================================================= -# SPECIFIC BACKUP -#================================================= -# ... -#================================================= - #================================================= # BACKUP A CRON FILE #================================================= diff --git a/scripts/install b/scripts/install index 31e0bed..86e9792 100644 --- a/scripts/install +++ b/scripts/install @@ -121,10 +121,9 @@ ynh_replace_string "__FINALPATH__" "$final_path" "$cron_path" chown -R $app: $final_path # Set the app as temporarily public for curl call -ynh_print_info "Configuring SSOwat..." -ynh_app_setting_set $app skipped_uris "/" -# Reload SSOwat config -yunohost app ssowatconf +ynh_script_progression --message="Configuring SSOwat..." +# Making the app public for curl +ynh_permission_update --permission="main" --add="visitors" # Reload Nginx systemctl reload nginx @@ -136,10 +135,7 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_local_curl "/index.php?mod=install" "password=$password" "confirmPassword=$password" "type=db" "db[host]=localhost" "db[user]=$db_name" "db[password]=$db_pwd" "db[dbname]=$db_name" # Remove the public access -if [ $is_public -eq 0 ] -then - ynh_app_setting_delete $app skipped_uris -fi +ynh_permission_update --permission="main" --remove="visitors" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 7441ba8..11f83bb 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,7 +19,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading settings..." +ynh_script_progression --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME @@ -27,11 +27,12 @@ domain=$(ynh_app_setting_get $app domain) path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) db_name=$(ynh_app_setting_get $app db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED #================================================= -ynh_print_info "Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -49,14 +50,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_print_info "Restoring the app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file "$final_path" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_print_info "Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) ynh_system_user_create $app @@ -74,11 +75,12 @@ chown -R $app: $final_path/var # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf" +ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf" + #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_print_info "Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_mysql_setup_db $db_name $db_name $db_pwd @@ -95,13 +97,13 @@ ynh_restore_file "/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info "Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 -systemctl reload php7.3-fpm -systemctl reload nginx +ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Restoration completed for $app" +ynh_script_progression --message="Restoration completed for $app" -last diff --git a/scripts/upgrade b/scripts/upgrade index 8251efa..deaab6a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -25,7 +25,7 @@ db_name=$(ynh_app_setting_get $app db_name) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_print_info "Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." # If db_name doesn't exist, create it if [ -z $db_name ]; then @@ -49,7 +49,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info "Backing up the app before upgrading (may take a while)..." +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 @@ -65,7 +65,7 @@ ynh_abort_if_errors #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Upgrading source files..." +ynh_script_progression --message="Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" @@ -73,7 +73,7 @@ ynh_setup_source "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config @@ -81,7 +81,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_print_info "Making sure dedicated system user exists..." +ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create $app @@ -89,7 +89,7 @@ ynh_system_user_create $app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading php-fpm configuration..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -97,14 +97,14 @@ ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= -ynh_print_info "Running specific upgrade..." +ynh_script_progression --message="Running specific upgrade..." # Give full access to "$app" so php script can do "its own magic stuff" chown -R $app: $final_path # Copy Yunohost custom script to cheky folder and launch it cp yunohost_upgrade_cheky.php $final_path/others/update/ -exec_as "$app" /usr/bin/php $final_path/others/update/yunohost_upgrade_cheky.php $final_path +ynh_exec_as "$app" /usr/bin/php $final_path/others/update/yunohost_upgrade_cheky.php $final_path #================================================= # GENERIC FINALIZATION @@ -122,7 +122,7 @@ chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sau #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading nginx web server..." systemctl reload nginx @@ -130,4 +130,4 @@ systemctl reload nginx # END OF SCRIPT #================================================= -ynh_print_info "Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" From 719128879eb91a28a71f3fbb16309c1b78a14447 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 10:40:09 +0200 Subject: [PATCH 03/10] Fix --- check_process | 2 +- manifest.json | 4 ++-- scripts/backup | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/check_process b/check_process index 8a4c77d..5cec907 100644 --- a/check_process +++ b/check_process @@ -4,7 +4,7 @@ path="/path" admin="john" is_public=1 - password="pass" + password="password" ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/manifest.json b/manifest.json index 3f180cc..dd2ffdb 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "cheky", "packaging_format": 1, "description": { - "en": "Monitors French classifieds websites LeBonCoin and SeLoger.", - "fr": "Surveille pour vous LeBonCoin et SeLoger." + "en": "Monitors French classifieds websites LeBonCoin and SeLoger", + "fr": "Surveille pour vous LeBonCoin et SeLoger" }, "version": "4.4.1~ynh4", "url": "https://www.cheky.net", diff --git a/scripts/backup b/scripts/backup index 9f6005d..0dbb3dd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -23,9 +23,9 @@ ynh_print_info "Loading installation settings..." app=$YNH_APP_INSTANCE_NAME -final_path=$(ynh_app_setting_get $app final_path) -domain=$(ynh_app_setting_get $app domain) -db_name=$(ynh_app_setting_get $app db_name) +final_path=$(ynh_app_setting_get --app=$app --key=final_path) +domain=$(ynh_app_setting_get --app=$app --key=domain) +db_name=$(ynh_app_setting_get --app=$app --key=db_name) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= @@ -37,32 +37,32 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE PHP-FPM CONFIGURATION #================================================= -ynh_backup "/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= ynh_print_info "Backing up the MySQL database..." -ynh_mysql_dump_db "$db_name" > db.sql +ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= # BACKUP A CRON FILE #================================================= -ynh_backup "/etc/cron.d/$app" +ynh_backup --src_path="/etc/cron.d/$app" #================================================= # END OF SCRIPT From 64f519569e347283136204a4c944503b1f08cf96 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 10:45:36 +0200 Subject: [PATCH 04/10] Fix --- conf/{cheky.cron => cron} | 0 scripts/install | 101 +++++++++++++++----------------------- 2 files changed, 40 insertions(+), 61 deletions(-) rename conf/{cheky.cron => cron} (100%) diff --git a/conf/cheky.cron b/conf/cron similarity index 100% rename from conf/cheky.cron rename to conf/cron diff --git a/scripts/install b/scripts/install index 86e9792..99bce2b 100644 --- a/scripts/install +++ b/scripts/install @@ -30,64 +30,66 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_print_info "Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." final_path=/var/www/$app -test ! -e "$final_path" || ynh_die "This path already contains a folder" - -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) +test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path -ynh_webpath_register $app $domain $path_url +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_print_info "Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." -ynh_app_setting_set $app domain $domain -ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app password $password +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url +ynh_app_setting_set --app=$app --key=password --value=$password + +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_print_info "Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." -db_name=$(ynh_sanitize_dbid $app) -ynh_app_setting_set $app db_name $db_name -ynh_mysql_setup_db $db_name $db_name +db_name=$(ynh_sanitize_dbid --db_name=$app) +db_user=$db_name +ynh_app_setting_set --app=$app --key=db_name --value=$db_name +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_print_info "Setting up source files..." +ynh_script_progression --message="Setting up source files..." -ynh_app_setting_set $app final_path $final_path +ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +ynh_setup_source --dest_dir="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info "Configuring nginx web server..." +ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_print_info "Configuring system user..." - -# Create a system user -ynh_system_user_create $app - #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Configuring php-fpm..." +ynh_script_progression --message="Configuring PHP-FPM..." # Create a dedicated php-fpm config ynh_add_fpm_config @@ -97,31 +99,21 @@ ynh_add_fpm_config #================================================= # Add cron job #================================================= -ynh_print_info "Configuring a cron task..." +ynh_script_progression --message="Configuring a cron task..." -# Path where crontab will be installed -cron_path="/etc/cron.d/$app" - -# Copy crontab from package to Yunohost -cp -a ../conf/cheky.cron "$cron_path" - -# Secure crontab -chown root: "$cron_path" -chmod 644 "$cron_path" - -# Configure crontab -ynh_replace_string "__USER__" "$app" "$cron_path" -ynh_replace_string "__FINALPATH__" "$final_path" "$cron_path" +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" +chown root: "/etc/cron.d/$app" +chmod 644 "/etc/cron.d/$app" #================================================= # SETUP APPLICATION WITH CURL #================================================= # Set right permissions for curl install -chown -R $app: $final_path +chown -R $app $final_path # Set the app as temporarily public for curl call -ynh_script_progression --message="Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Making the app public for curl ynh_permission_update --permission="main" --add="visitors" @@ -129,7 +121,7 @@ ynh_permission_update --permission="main" --add="visitors" systemctl reload nginx # Installation with curl -ynh_print_info "Finalizing installation..." +ynh_script_progression --message="Finalizing installation..." # Get database password db_pwd=$(ynh_app_setting_get $app mysqlpwd) ynh_local_curl "/index.php?mod=install" "password=$password" "confirmPassword=$password" "type=db" "db[host]=localhost" "db[user]=$db_name" "db[password]=$db_pwd" "db[dbname]=$db_name" @@ -137,23 +129,10 @@ ynh_local_curl "/index.php?mod=install" "password=$password" "confirmPassword=$p # Remove the public access ynh_permission_update --permission="main" --remove="visitors" -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions to app files -chown -R root: $final_path - -# Folders that needs to be writable by cheky -chown -R $app: $final_path/var # requirement in official documentation -chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sauvegardées" tab - #================================================= # SETUP SSOWAT #================================================= -ynh_print_info "Configuring SSOwat..." +ynh_script_progression --message="Configuring permissions..." # Make app public if necessary if [ $is_public -eq 1 ] @@ -164,12 +143,12 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info "Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Installation of $app completed" +ynh_script_progression --message="Installation of $app completed" From 913efccf862bb132bba5c14be66faf6d0f0d84eb Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 10:53:00 +0200 Subject: [PATCH 05/10] Fix --- scripts/remove | 22 ++++++------- scripts/restore | 51 ++++++++++++++--------------- scripts/upgrade | 87 ++++++++++++++++++++++++++++--------------------- 3 files changed, 85 insertions(+), 75 deletions(-) diff --git a/scripts/remove b/scripts/remove index f29081d..8a02bda 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_print_info "Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -26,7 +26,7 @@ final_path=$(ynh_app_setting_get $app final_path) #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_print_info "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 @@ -34,15 +34,15 @@ ynh_mysql_remove_db $db_user $db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_print_info "Removing app main directory" +ynh_script_progression --message="Removing app main directory" # Remove the app directory securely -ynh_secure_remove "$final_path" +ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info "Removing nginx web server configuration" +ynh_script_progression --message="Removing NGINX web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config @@ -50,7 +50,7 @@ ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_print_info "Removing php-fpm configuration" +ynh_script_progression --message="Removing PHP-FPM configuration" # Remove the dedicated php-fpm config ynh_remove_fpm_config @@ -62,23 +62,23 @@ ynh_remove_fpm_config #================================================= # Remove a cron file -ynh_secure_remove "/etc/cron.d/$app" +ynh_secure_remove --file="/etc/cron.d/$app" # Remove the log files -ynh_secure_remove "/var/log/$app/" +ynh_secure_remove --file="/var/log/$app/" #================================================= # GENERIC FINALIZATION #================================================= # REMOVE DEDICATED USER #================================================= -ynh_print_info "Removing the dedicated system user" +ynh_script_progression --message="Removing the dedicated system user" # Delete a system user -ynh_system_user_delete $app +ynh_system_user_delete --username=$app #================================================= # END OF SCRIPT #================================================= -ynh_print_info "Removal of $app completed" +ynh_script_progression --message="Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 11f83bb..5f03a5a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -19,20 +19,20 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME -domain=$(ynh_app_setting_get $app domain) -path_url=$(ynh_app_setting_get $app path) -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) +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 IF THE APP CAN BE RESTORED #================================================= -ynh_script_progression --message="Validating restoration parameters..." +ynh_script_progression --message="Validating restoration parameters..." --weight=1 ynh_webpath_available $domain $path_url \ || ynh_die "Path not available: ${domain}${path_url}" @@ -45,52 +45,49 @@ test ! -d $final_path \ # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." - -ynh_restore_file "$final_path" +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # RECREATE THE DEDICATED USER #================================================= -ynh_script_progression --message="Recreating the dedicated system user..." +ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create $app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=5 -# Restore permissions on app files -chown -R root: $final_path -# Only path that needs to be writable by cheky -chown -R $app: $final_path/var +ynh_restore_file --origin_path="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1 -ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" #================================================= # RESTORE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Restoring the MySQL database..." +ynh_script_progression --message="Restoring the MySQL database..." --weight=1 -db_pwd=$(ynh_app_setting_get $app mysqlpwd) -ynh_mysql_setup_db $db_name $db_name $db_pwd -ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql +db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) +ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd +ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RESTORE THE CRON FILE #================================================= +ynh_script_progression --message="Restoring various files..." --weight=1 -ynh_restore_file "/etc/cron.d/$app" +ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index deaab6a..12e9704 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_script_progression --message="Loading installation settings..." --weight=1 app=$YNH_APP_INSTANCE_NAME @@ -21,11 +21,32 @@ 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) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + +#================================================= +# CHECK 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 + +# Backup the current version of the app +ynh_backup_before_upgrade +ynh_clean_setup () { + # Restore it if the upgrade fails + ynh_restore_upgradebackup +} +# Exit if an error occurs during the execution of the script +ynh_abort_if_errors #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # If db_name doesn't exist, create it if [ -z $db_name ]; then @@ -49,7 +70,7 @@ fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -60,36 +81,44 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1 + +# 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 #================================================= -ynh_script_progression --message="Upgrading source files..." -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source "$final_path" +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=4 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" +fi + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1 # Create a dedicated nginx config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create $app - #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading php-fpm configuration..." +ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 # Create a dedicated php-fpm config ynh_add_fpm_config @@ -97,37 +126,21 @@ ynh_add_fpm_config #================================================= # SPECIFIC UPGRADE #================================================= -ynh_script_progression --message="Running specific upgrade..." - -# Give full access to "$app" so php script can do "its own magic stuff" -chown -R $app: $final_path +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 $final_path/others/update/yunohost_upgrade_cheky.php $final_path - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -# Set permissions on app files -chown -R root: $final_path - -# Folders that needs to be writable by cheky -chown -R $app: $final_path/var # requirement in official documentation -chown -R $app: $final_path/static/media/annonce # needed for "Mes annonces sauvegardées" tab +ynh_exec_as "$app" /usr/bin/php$phpversion $final_path/others/update/yunohost_upgrade_cheky.php $final_path #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" +ynh_script_progression --message="Upgrade of $app completed" --last From f8b027969f53c4921e0a655e94a89bb24630c232 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 11:32:10 +0200 Subject: [PATCH 06/10] Fix --- conf/nginx.conf | 2 +- scripts/restore | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 02ab5bc..a563eaa 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -17,7 +17,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/scripts/restore b/scripts/restore index 5f03a5a..7456256 100644 --- a/scripts/restore +++ b/scripts/restore @@ -27,6 +27,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +db_user=$db_name phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= From 7bcb567684e8f47488e251dea0d77dd034a1e986 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 11:37:57 +0200 Subject: [PATCH 07/10] Update remove --- scripts/remove | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/remove b/scripts/remove index 8a02bda..a095f2d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -64,9 +64,6 @@ ynh_remove_fpm_config # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" -# Remove the log files -ynh_secure_remove --file="/var/log/$app/" - #================================================= # GENERIC FINALIZATION #================================================= From a7b8631c461e31ff7f8db6df005a9c78a3b643ef Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 11:42:19 +0200 Subject: [PATCH 08/10] Fix --- check_process | 1 - doc/DISCLAIMER.md | 10 ++++++++++ doc/DISCLAIMER_fr.md | 11 +++++++++++ manifest.json | 13 +++++++------ 4 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 doc/DISCLAIMER.md create mode 100644 doc/DISCLAIMER_fr.md diff --git a/check_process b/check_process index 5cec907..61ff237 100644 --- a/check_process +++ b/check_process @@ -2,7 +2,6 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" is_public=1 password="password" ; Checks diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..41bd0bd --- /dev/null +++ b/doc/DISCLAIMER.md @@ -0,0 +1,10 @@ +## Features + +* [Cheky](https://www.cheky.net) allows you to create various alerts for french classifieds ads website like [Leboncoin](http://leboncoin.fr/) and [SeLoger](http://www.seloger.com/). +* If you do not live in France, it will not be really useful for you + +## Limitations + +* 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). diff --git a/doc/DISCLAIMER_fr.md b/doc/DISCLAIMER_fr.md new file mode 100644 index 0000000..63a31e2 --- /dev/null +++ b/doc/DISCLAIMER_fr.md @@ -0,0 +1,11 @@ +## Features + +* [Cheky](https://www.cheky.net) vous permet de créer des alertes [Leboncoin](http://leboncoin.fr/) et des alertes [SeLoger](http://www.seloger.com/). +* Vous pouvez ainsi suivre gratuitement, en fonction de vos critères de recherche, les nouvelles annonces mises en ligne sur ces sites internet. +* Les alertes peuvent être envoyées par mail, flux RSS et SMS. + +## 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). diff --git a/manifest.json b/manifest.json index dd2ffdb..c7ebe2a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,13 @@ "en": "Monitors French classifieds websites LeBonCoin and SeLoger", "fr": "Surveille pour vous LeBonCoin et SeLoger" }, - "version": "4.4.1~ynh4", + "version": "4.4.1~ynh5", "url": "https://www.cheky.net", + "upstream": { + "license": "GPL-3.0-or-later", + "website": "https://www.cheky.net", + "code": "https://github.com/Blount/Cheky" + }, "license": "GPL-3.0-or-later", "maintainer": { "name": "Gofannon", @@ -27,7 +32,7 @@ } ], "requirements": { - "yunohost": ">= 4.2.0" + "yunohost": ">= 4.2.4" }, "multi_instance": true, "services": [ @@ -56,10 +61,6 @@ { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true } ] From 61dd3771191c66fd76e07772f4f52203bac5ed2b Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 19 Jul 2021 09:42:27 +0000 Subject: [PATCH 09/10] Auto-update README --- README.md | 84 +++++++++++++++++++++------------------------------- README_fr.md | 52 ++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 51 deletions(-) create mode 100644 README_fr.md diff --git a/README.md b/README.md index fb37048..3c0b382 100644 --- a/README.md +++ b/README.md @@ -1,73 +1,55 @@ + + # Cheky for YunoHost -[![Integration level](https://dash.yunohost.org/integration/cheky.svg)](https://dash.yunohost.org/appci/app/cheky) -[![Install Cheky with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=cheky) +[![Integration level](https://dash.yunohost.org/integration/cheky.svg)](https://dash.yunohost.org/appci/app/cheky) ![](https://ci-apps.yunohost.org/ci/badges/cheky.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/cheky.maintain.svg) +[![Install Cheky with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=cheky) -> *This package allow you to install cheky quickly and simply on a YunoHost server. -If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* +*[Lire ce readme en français.](./README_fr.md)* -**Shipped version:** 4.4.1 +> *This package allows you to install Cheky quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* + +## Overview + +Monitors French classifieds websites LeBonCoin and SeLoger + +**Shipped version:** 4.4.1~ynh5 + + + +## Disclaimers / important information ## Features -### Français - -* [Cheky](https://www.cheky.net) vous permet de créer des alertes [Leboncoin](http://leboncoin.fr/) et des alertes [SeLoger](http://www.seloger.com/). -* Vous pouvez ainsi suivre gratuitement, en fonction de vos critères de recherche, les nouvelles annonces mises en ligne sur ces sites internet. -* Les alertes peuvent être envoyées par mail, flux RSS et SMS. - -### English - * [Cheky](https://www.cheky.net) allows you to create various alerts for french classifieds ads website like [Leboncoin](http://leboncoin.fr/) and [SeLoger](http://www.seloger.com/). * If you do not live in France, it will not be really useful for you ## 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). +* 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). -## Additionnal informations - -* Anciennement nommé LBCAlerte. Renommé depuis la [version 3.4](https://www.cheky.net/changelog#v3_4) - -## Links +## Documentation and resources +* Official app website: https://www.cheky.net +* Upstream app code repository: https://github.com/Blount/Cheky +* YunoHost documentation for this app: https://yunohost.org/app_cheky * Report a bug: https://github.com/YunoHost-Apps/cheky_ynh/issues -* Cheky website: https://www.cheky.net -* Cheky changelog : https://github.com/Blount/Cheky/blob/master/CHANGELOG.txt -* YunoHost website: https://yunohost.org ---- +## Developer info -## Informations pour développeurs et développeuses +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/cheky_ynh/tree/testing). -**Si vous savez ce que vous faites ET que vous souhaitez passer sur une version instable pour tester ou coder** - -Au lieu de fusionner directement dans `master`, merci d'envoyer vos "pull request" dans la [branche de test `testing`](https://github.com/YunoHost-Apps/cheky_ynh/tree/testing) - -Pour basculer sur la branche `testing`, merci de procéder ainsi: - -```bash +To try the testing branch, please proceed like that. +``` sudo yunohost app install https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug or -sudo yunohost app upgrade cheky --url https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug +sudo yunohost app upgrade cheky -u https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug ``` -## Historique des versions - -* 4.4.1~ynh4 (11 March 2019) - * changed: upgrade Cheky to 4.4.1 - * fix automated upgrade method - * fix scripts `backup` and `restore` - [md-clone](https://github.com/md-clone) with [#19](https://github.com/YunoHost-Apps/cheky_ynh/pull/19) -* 4.4~ynh4 (4 March 2019) - * removed: Debian Jessie support is dropped in favor to Stretch only (Yunohost version > 3) - * changed: follow lastest rules from - * fixed: remove old php file - * changed: increment YunoHost package version to `ynh4` -* 24 Feb 2019 [#16](https://github.com/YunoHost-Apps/cheky_ynh/pull/16) - Mise à jour vers la version 4.4 -* 24 Sep 2018 [#11](https://github.com/YunoHost-Apps/cheky_ynh/pull/11) - Mise à jour vers la version 4.3.5 -* 14 Sep 2018 [10](https://github.com/YunoHost-Apps/cheky_ynh/pull/10) - Correction images dans "annonces sauvegardées" -* 3 Sep 2018 [#8](https://github.com/YunoHost-Apps/cheky_ynh/pull/8) - Mise à jour vers la version 4.3.3 -* 8 Aug 2018 [#4](https://github.com/YunoHost-Apps/cheky_ynh/pull/4) - Mise à jour vers la version 4.1 -* 9 Aug 2018 [#5](https://github.com/YunoHost-Apps/cheky_ynh/pull/5) - Mise à jour vers la version 4.1 +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..516ec9e --- /dev/null +++ b/README_fr.md @@ -0,0 +1,52 @@ +# Cheky pour YunoHost + +[![Niveau d'intégration](https://dash.yunohost.org/integration/cheky.svg)](https://dash.yunohost.org/appci/app/cheky) ![](https://ci-apps.yunohost.org/ci/badges/cheky.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/cheky.maintain.svg) +[![Installer Cheky avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=cheky) + +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* + +> *Ce package vous permet d'installer Cheky rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* + +## Vue d'ensemble + +Surveille pour vous LeBonCoin et SeLoger + +**Version incluse :** 4.4.1~ynh5 + + + +## Avertissements / informations importantes + +## Features + +* [Cheky](https://www.cheky.net) vous permet de créer des alertes [Leboncoin](http://leboncoin.fr/) et des alertes [SeLoger](http://www.seloger.com/). +* Vous pouvez ainsi suivre gratuitement, en fonction de vos critères de recherche, les nouvelles annonces mises en ligne sur ces sites internet. +* Les alertes peuvent être envoyées par mail, flux RSS et SMS. + +## 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). + +## Documentations et ressources + +* Site officiel de l'app : https://www.cheky.net +* Dépôt de code officiel de l'app : https://github.com/Blount/Cheky +* Documentation YunoHost pour cette app : https://yunohost.org/app_cheky +* Signaler un bug : https://github.com/YunoHost-Apps/cheky_ynh/issues + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/cheky_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug +ou +sudo yunohost app upgrade cheky -u https://github.com/YunoHost-Apps/cheky_ynh/tree/testing --debug +``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file From 3f0e3fab822d5746093b02a1317ef86e578d57b4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 19 Jul 2021 11:43:51 +0200 Subject: [PATCH 10/10] Update check_process --- check_process | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/check_process b/check_process index 61ff237..051ed3f 100644 --- a/check_process +++ b/check_process @@ -12,10 +12,15 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=a6b2615101887e3235aab0b95607eb1b58507a4c + upgrade=1 from_commit=ee9a1c83c800c4bf269a8c798468aaaeb3a9accb backup_restore=1 multi_instance=1 change_url=0 ;;; Options Email= Notification=none +;;; Upgrade options + ; commit=ee9a1c83c800c4bf269a8c798468aaaeb3a9accb + name=Merge pull request #23 from YunoHost-Apps/testing + manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& +