diff --git a/README.md b/README.md index 9b9865b..b523625 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Gotify is a simple server for sending and receiving messages in real-time per we ## Configuration How to configure this app: -> Edit config.yml file via SSH. +> Edit `config.yml` file via SSH. ## Documentation @@ -33,7 +33,7 @@ LDAP is not supported (blocked until Gotify core upstream implements it). ## Limitations - * Require dedicated domain like gotify.domain.tld. + * Require dedicated domain like `gotify.domain.tld` ## Links @@ -44,8 +44,7 @@ LDAP is not supported (blocked until Gotify core upstream implements it). --- -Developers info ----------------- +## Developers info Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/gotify_ynh/tree/testing). diff --git a/README_fr.md b/README_fr.md index dd06dd3..b301310 100644 --- a/README_fr.md +++ b/README_fr.md @@ -3,7 +3,6 @@ [![Integration level](https://dash.yunohost.org/integration/gotify.svg)](https://dash.yunohost.org/appci/app/gotify) ![](https://ci-apps.yunohost.org/ci/badges/gotify.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/gotify.maintain.svg) [![Install Gotify with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=gotify) - *[Read this readme in english.](./README.md)* > *Ce package vous permet d'installer Gotify rapidement et simplement sur un serveur Yunohost. @@ -21,7 +20,7 @@ Gotify est un serveur simple permettant d'envoyer et de recevoir des messages vi ## Configuration Pour configurer Gotify : -> Edit config.yml file via SSH. +> Éditer le fichier `config.yml` avec SSH. ## Documentation @@ -34,7 +33,7 @@ Pas de support de LDAP (non implémenté upstream) ## Limitations - * Nécessite un domaine dédié comme par exemple gotify.domain.tld. + * Nécessite un domaine dédié comme par exemple `gotify.domain.tld` ## Liens @@ -45,8 +44,7 @@ Pas de support de LDAP (non implémenté upstream) --- -Informations pour les développeurs ----------------- +## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/gotify_ynh/tree/testing). diff --git a/manifest.json b/manifest.json index 1bfc149..de61340 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "plopoyop@gmail.com" }, "requirements": { - "yunohost": ">= 3.7.0" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index 6638067..8c4da07 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,16 +1,20 @@ #!/bin/bash -# ============= FUTURE YUNOHOST HELPER ============= -# Delete a file checksum from the app settings -# -# $app should be defined when calling this helper -# -# usage: ynh_remove_file_checksum file -# | arg: file - The file for which the checksum will be deleted -ynh_delete_file_checksum () { - local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_' - ynh_app_setting_delete $app $checksum_setting_name -} +#================================================= +# COMMON VARIABLES +#================================================= + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then architecture="arm64" diff --git a/scripts/backup b/scripts/backup index a107bf4..9f59389 100755 --- a/scripts/backup +++ b/scripts/backup @@ -13,13 +13,12 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= -# Exit if an error occurs during the execution of the script ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME @@ -28,32 +27,37 @@ domain=$(ynh_app_setting_get $app domain) db_name=$(ynh_app_setting_get $app db_name) #================================================= -# 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_script_progression --message="Backing up the main app directory..." --weight=30 -ynh_backup "$final_path" +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1 -ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Backing up the MySQL database..." --weight=20 - -ynh_mysql_dump_db "$db_name" > db.sql +ynh_print_info --message="Backing up the MySQL database..." +ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= # BACKUP SYSTEMD #================================================= -ynh_backup "/etc/systemd/system/$app.service" -ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)" --last \ No newline at end of file +ynh_backup --src_path="/etc/systemd/system/$app.service" + +#================================================= +# END OF SCRIPT +#================================================= + +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 b45f828..fff7f5f 100755 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,6 @@ source /usr/share/yunohost/helpers # Exit if an error occurs during the execution of the script ynh_abort_if_errors - #================================================= # RETRIEVE ARGUMENTS FROM THE MANIFEST #================================================= @@ -70,7 +69,7 @@ ynh_app_setting_set $app port $port #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_script_progression --message="Creating a MySQL database..." --weight=20 +ynh_script_progression --message="Creating a MySQL database..." --weight=10 db_name=$(ynh_sanitize_dbid $app) ynh_app_setting_set $app db_name $db_name @@ -88,7 +87,7 @@ ynh_setup_source "$final_path" $architecture #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --weight=2 +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated nginx config ynh_add_nginx_config @@ -101,7 +100,6 @@ ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user ynh_system_user_create $app - #================================================= # SETUP SYSTEMD #================================================= @@ -160,7 +158,7 @@ ynh_permission_update --permission "main" --add visitors #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 systemctl reload nginx diff --git a/scripts/remove b/scripts/remove index ae063a3..71a1cb5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -28,7 +28,6 @@ final_path=$(ynh_app_setting_get $app final_path) # REMOVE SERVICE FROM ADMIN PANEL #================================================= -# Remove a service from the admin panel, added by `yunohost service add` if yunohost service status | grep -q $app then ynh_script_progression --message="Remove $app service" --weight=1 @@ -46,7 +45,7 @@ ynh_remove_systemd_config #================================================= # REMOVE THE MYSQL DATABASE #================================================= -ynh_script_progression --message="Removing the MySQL database..." --weight=10 +ynh_script_progression --message="Removing the MySQL database..." --weight=6 # Remove a database if it exists, along with the associated user ynh_mysql_remove_db $db_user $db_name @@ -54,7 +53,7 @@ ynh_mysql_remove_db $db_user $db_name #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=30 +ynh_script_progression --message="Removing app main directory..." --weight=10 # Remove the app directory securely ynh_secure_remove "$final_path" @@ -62,7 +61,7 @@ ynh_secure_remove "$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." --weight=5 +ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2 # Remove the dedicated nginx config ynh_remove_nginx_config @@ -72,9 +71,13 @@ ynh_remove_nginx_config #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=5 +ynh_script_progression --message="Removing the dedicated system user..." --weight=1 # Delete a system user -ynh_system_user_delete $app +ynh_system_user_delete --username=$app -ynh_script_progression --message="Removal of $app completed" --last \ No newline at end of file +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 2c0ed46..b60a9e4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -43,7 +43,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring nginx configuration..." --weight=1 +ynh_script_progression --message="Restoring NGINX configuration..." --weight=1 ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf" @@ -95,13 +95,18 @@ yunohost service add $app ynh_script_progression --message="Restoring service..." --weight=10 ynh_restore_file "/etc/systemd/system/$app.service" -systemctl enable $app.service +systemctl enable $app.service --quiet systemctl start $app + #================================================= # GENERIC FINALIZATION #================================================= -ynh_script_progression --message="Reloading nginx web server ..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 systemctl reload nginx +#================================================= +# END OF SCRIPT +#================================================= + ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index e517fb7..28df7fd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,9 +86,9 @@ ynh_setup_source "$final_path" $architecture #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 -# Create a dedicated nginx config +# Create a dedicated NGINX config if [ "$path_url" != "/" ] then ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf" @@ -108,8 +108,6 @@ ynh_system_user_create $app # SPECIFIC UPGRADE #================================================= -### 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 "$final_path/config.yml" cp ../conf/config.yml "$final_path/config.yml" @@ -151,6 +149,12 @@ fi # check data directory permission chown -R $app: $final_path/data +#================================================= +# ADVERTISE SERVICE IN ADMIN PANEL +#================================================= + +yunohost service add $app + #================================================= # SETUP SSOWAT #================================================= @@ -173,8 +177,12 @@ systemctl restart $app #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 -systemctl reload nginx +ynh_systemd_action --service_name=nginx --action=reload -ynh_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Upgrade of $app completed" --last