From 1681ee469203bcd4fdf92703084d824e041cd6c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 9 Jun 2020 21:50:55 +0200 Subject: [PATCH 1/5] fix architecture detection --- conf/arm-7.src | 6 ++++++ scripts/_common.sh | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 conf/arm-7.src diff --git a/conf/arm-7.src b/conf/arm-7.src new file mode 100644 index 0000000..5f00e53 --- /dev/null +++ b/conf/arm-7.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.16/gotify-linux-arm-7.zip +SOURCE_SUM=c0919fa83fadf6ffee12b14dd94c0662bff69e83c11f51f9f1228ac374f91bf0 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME=gotify-linux-arm-7 diff --git a/scripts/_common.sh b/scripts/_common.sh index c104bf7..6638067 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -12,11 +12,13 @@ ynh_delete_file_checksum () { ynh_app_setting_delete $app $checksum_setting_name } -if [ -n "$(uname -m | grep 64)" ]; then +if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then + architecture="arm64" +elif [ -n "$(uname -m | grep 64)" ]; then architecture="amd64" elif [ -n "$(uname -m | grep arm)" ]; then - architecture="arm" + architecture="arm-7" else ynh_die "Unable to detect your achitecture, please open a bug describing \ your hardware and the result of the command \"uname -m\"." 1 -fi +fi \ No newline at end of file From b5b8a60ce4469390680cd04b351876bb39b4bc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment?= Date: Tue, 9 Jun 2020 21:53:56 +0200 Subject: [PATCH 2/5] fix systemd service --- conf/arm-7.src | 2 +- conf/arm.src | 6 ------ conf/systemd.service | 2 +- scripts/install | 1 + scripts/upgrade | 1 + 5 files changed, 4 insertions(+), 8 deletions(-) delete mode 100644 conf/arm.src diff --git a/conf/arm-7.src b/conf/arm-7.src index 5f00e53..c70abf2 100644 --- a/conf/arm-7.src +++ b/conf/arm-7.src @@ -1,5 +1,5 @@ SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.16/gotify-linux-arm-7.zip -SOURCE_SUM=c0919fa83fadf6ffee12b14dd94c0662bff69e83c11f51f9f1228ac374f91bf0 +SOURCE_SUM=62cd54303a79af678a77b8591836851c31cebf83c48392fd149007ba39926691 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/arm.src b/conf/arm.src deleted file mode 100644 index c70abf2..0000000 --- a/conf/arm.src +++ /dev/null @@ -1,6 +0,0 @@ -SOURCE_URL=https://github.com/gotify/server/releases/download/v2.0.16/gotify-linux-arm-7.zip -SOURCE_SUM=62cd54303a79af678a77b8591836851c31cebf83c48392fd149007ba39926691 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false -SOURCE_FILENAME=gotify-linux-arm-7 diff --git a/conf/systemd.service b/conf/systemd.service index 8151764..7d424a4 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=__FINALPATH__/gotify-linux-amd64 +ExecStart=__FINALPATH__/gotify-linux-__ARCHITECTURE__ [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 0735709..b45f828 100755 --- a/scripts/install +++ b/scripts/install @@ -107,6 +107,7 @@ ynh_system_user_create $app #================================================= # Create a dedicated systemd config +ynh_replace_string "__ARCHITECTURE__" $architecture "../conf/systemd.service" ynh_add_systemd_config #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 67c663e..e517fb7 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -129,6 +129,7 @@ ynh_store_file_checksum "$final_path/config.yml" #================================================= # Create a dedicated systemd config +ynh_replace_string "__ARCHITECTURE__" $architecture "../conf/systemd.service" ynh_add_systemd_config #================================================= From d4fc008087620b00996cd6b7f9c5516dbe9e48c2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 22 Nov 2020 15:27:37 +0100 Subject: [PATCH 3/5] Fix linter ans small typos --- README.md | 7 +++---- README_fr.md | 8 +++----- check_process | 11 ----------- manifest.json | 4 ++-- scripts/_common.sh | 26 +++++++++++++++----------- scripts/backup | 28 ++++++++++++++++------------ scripts/install | 8 +++----- scripts/remove | 17 ++++++++++------- scripts/restore | 9 +++++++-- scripts/upgrade | 14 +++++++++----- 10 files changed, 68 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index c47d4b4..8d14fd3 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 4cdb9b7..faf05ed 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/check_process b/check_process index 7719705..10ea509 100644 --- a/check_process +++ b/check_process @@ -23,18 +23,7 @@ port_already_use=1 change_url=0 ;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: If the app supports LDAP and SSOwat, turn level 4 to '1' and add a link to an issue or a part of your code to show it. -# If the app does not use LDAP nor SSOwat, and can't use them, turn level 4 to 'na' and explain as well. - Level 4=0 Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Upgrade options ; commit=e0fbbb9a6d2fd87b4d42e85c0fc8f4e479689abc name=Mon Feb 18 21:55:49 2019 +0100 Merge branch 'master' of github.com:YunoHost-Apps/gotify_ynh diff --git a/manifest.json b/manifest.json index 8a0556f..aed833e 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "A simple server for sending and receiving messages.", "fr": "Un simple serveur pour envoyer et recevoir des messages." }, - "version": "2.0.16~ynh2", + "version": "2.0.16~ynh3", "url": "http://gotify.net", "license": "MIT", "maintainer": { @@ -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..d1e7f6f 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" @@ -97,11 +97,16 @@ ynh_script_progression --message="Restoring service..." --weight=10 ynh_restore_file "/etc/systemd/system/$app.service" systemctl enable $app.service 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..195e05a 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -86,7 +86,7 @@ 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 if [ "$path_url" != "/" ] @@ -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,8 @@ 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_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file +ynh_script_progression --message="Upgrade of $app completed" --last From e1ec9f7ca37bf018488f48df2ae11da241004b3d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 30 Nov 2020 15:03:53 +0100 Subject: [PATCH 4/5] Update check_process --- check_process | 2 -- 1 file changed, 2 deletions(-) diff --git a/check_process b/check_process index 10ea509..dbfc282 100644 --- a/check_process +++ b/check_process @@ -22,8 +22,6 @@ incorrect_path=0 port_already_use=1 change_url=0 -;;; Levels - Level 5=auto ;;; Upgrade options ; commit=e0fbbb9a6d2fd87b4d42e85c0fc8f4e479689abc name=Mon Feb 18 21:55:49 2019 +0100 Merge branch 'master' of github.com:YunoHost-Apps/gotify_ynh From e28af46145a51dd56f0fe3c1a7d2f76a478ea5d6 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 30 Nov 2020 15:07:53 +0100 Subject: [PATCH 5/5] Small typos --- scripts/restore | 4 ++-- scripts/upgrade | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/restore b/scripts/restore index d1e7f6f..b60a9e4 100755 --- a/scripts/restore +++ b/scripts/restore @@ -95,13 +95,13 @@ 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 diff --git a/scripts/upgrade b/scripts/upgrade index 195e05a..28df7fd 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,7 @@ ynh_setup_source "$final_path" $architecture #================================================= 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" @@ -179,6 +179,10 @@ systemctl restart $app #================================================= 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" --last