1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/gotify_ynh.git synced 2024-09-03 20:36:26 +02:00

Merge pull request #25 from YunoHost-Apps/Fix-linter

Fix linter
This commit is contained in:
Clément 2020-12-05 09:47:46 +01:00 committed by GitHub
commit ff239dec91
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 83 additions and 73 deletions

View file

@ -20,7 +20,7 @@ Gotify is a simple server for sending and receiving messages in real-time per we
## Configuration ## Configuration
How to configure this app: How to configure this app:
> Edit config.yml file via SSH. > Edit `config.yml` file via SSH.
## Documentation ## Documentation
@ -33,7 +33,7 @@ LDAP is not supported (blocked until Gotify core upstream implements it).
## Limitations ## Limitations
* Require dedicated domain like gotify.domain.tld. * Require dedicated domain like `gotify.domain.tld`
## Links ## 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). Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/gotify_ynh/tree/testing).

View file

@ -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) [![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) [![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)* *[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Gotify rapidement et simplement sur un serveur Yunohost. > *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 ## Configuration
Pour configurer Gotify : Pour configurer Gotify :
> Edit config.yml file via SSH. > Éditer le fichier `config.yml` avec SSH.
## Documentation ## Documentation
@ -34,7 +33,7 @@ Pas de support de LDAP (non implémenté upstream)
## Limitations ## 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 ## 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). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/gotify_ynh/tree/testing).

View file

@ -22,19 +22,6 @@
incorrect_path=0 incorrect_path=0
port_already_use=1 port_already_use=1
change_url=0 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 ;;; Upgrade options
; commit=e0fbbb9a6d2fd87b4d42e85c0fc8f4e479689abc ; commit=e0fbbb9a6d2fd87b4d42e85c0fc8f4e479689abc
name=Mon Feb 18 21:55:49 2019 +0100 Merge branch 'master' of github.com:YunoHost-Apps/gotify_ynh name=Mon Feb 18 21:55:49 2019 +0100 Merge branch 'master' of github.com:YunoHost-Apps/gotify_ynh

View file

@ -8,7 +8,7 @@ Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__/ WorkingDirectory=__FINALPATH__/
ExecStart=__FINALPATH__/gotify-linux-amd64 ExecStart=__FINALPATH__/gotify-linux-__ARCHITECTURE__
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -6,7 +6,7 @@
"en": "A simple server for sending and receiving messages.", "en": "A simple server for sending and receiving messages.",
"fr": "Un simple serveur pour envoyer et recevoir des 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", "url": "http://gotify.net",
"license": "MIT", "license": "MIT",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "plopoyop@gmail.com" "email": "plopoyop@gmail.com"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.7.0" "yunohost": ">= 3.8.1"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -1,21 +1,27 @@
#!/bin/bash #!/bin/bash
# ============= FUTURE YUNOHOST HELPER ============= #=================================================
# Delete a file checksum from the app settings # COMMON VARIABLES
# #=================================================
# $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
}
if [ -n "$(uname -m | grep 64)" ]; then #=================================================
# PERSONAL HELPERS
#=================================================
#=================================================
# EXPERIMENTAL HELPERS
#=================================================
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then
architecture="arm64"
elif [ -n "$(uname -m | grep 64)" ]; then
architecture="amd64" architecture="amd64"
elif [ -n "$(uname -m | grep arm)" ]; then elif [ -n "$(uname -m | grep arm)" ]; then
architecture="arm" architecture="arm-7"
else else
ynh_die "Unable to detect your achitecture, please open a bug describing \ ynh_die "Unable to detect your achitecture, please open a bug describing \
your hardware and the result of the command \"uname -m\"." 1 your hardware and the result of the command \"uname -m\"." 1

View file

@ -13,13 +13,12 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME 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) 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 # 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 # 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 # BACKUP THE MYSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Backing up the MySQL database..." --weight=20 ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db "$db_name" > db.sql
ynh_mysql_dump_db --database="$db_name" > db.sql
#================================================= #=================================================
# BACKUP SYSTEMD # BACKUP SYSTEMD
#================================================= #=================================================
ynh_backup "/etc/systemd/system/$app.service" ynh_backup --src_path="/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
#=================================================
# END OF SCRIPT
#=================================================
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)"

View file

@ -16,7 +16,6 @@ source /usr/share/yunohost/helpers
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
@ -70,7 +69,7 @@ ynh_app_setting_set $app port $port
#================================================= #=================================================
# CREATE A MYSQL DATABASE # 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) db_name=$(ynh_sanitize_dbid $app)
ynh_app_setting_set $app db_name $db_name ynh_app_setting_set $app db_name $db_name
@ -88,7 +87,7 @@ ynh_setup_source "$final_path" $architecture
#================================================= #=================================================
# NGINX CONFIGURATION # 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 # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -101,12 +100,12 @@ ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user # Create a system user
ynh_system_user_create $app ynh_system_user_create $app
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_replace_string "__ARCHITECTURE__" $architecture "../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
#================================================= #=================================================
@ -159,7 +158,7 @@ ynh_permission_update --permission "main" --add visitors
#================================================= #=================================================
# RELOAD NGINX # 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 systemctl reload nginx

View file

@ -28,7 +28,6 @@ final_path=$(ynh_app_setting_get $app final_path)
# REMOVE SERVICE FROM ADMIN PANEL # REMOVE SERVICE FROM ADMIN PANEL
#================================================= #=================================================
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status | grep -q $app if yunohost service status | grep -q $app
then then
ynh_script_progression --message="Remove $app service" --weight=1 ynh_script_progression --message="Remove $app service" --weight=1
@ -46,7 +45,7 @@ ynh_remove_systemd_config
#================================================= #=================================================
# REMOVE THE MYSQL DATABASE # 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 # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db $db_user $db_name ynh_mysql_remove_db $db_user $db_name
@ -54,7 +53,7 @@ ynh_mysql_remove_db $db_user $db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # 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 # Remove the app directory securely
ynh_secure_remove "$final_path" ynh_secure_remove "$final_path"
@ -62,7 +61,7 @@ ynh_secure_remove "$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # 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 # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -72,9 +71,13 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE DEDICATED USER # 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 # Delete a system user
ynh_system_user_delete $app ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -43,7 +43,7 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # 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" 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_script_progression --message="Restoring service..." --weight=10
ynh_restore_file "/etc/systemd/system/$app.service" ynh_restore_file "/etc/systemd/system/$app.service"
systemctl enable $app.service systemctl enable $app.service --quiet
systemctl start $app systemctl start $app
#================================================= #=================================================
# GENERIC FINALIZATION # 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 systemctl reload nginx
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -86,9 +86,9 @@ ynh_setup_source "$final_path" $architecture
#================================================= #=================================================
# NGINX CONFIGURATION # 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" != "/" ] if [ "$path_url" != "/" ]
then then
ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf" ynh_replace_string "^#sub_path_only" "" "../conf/nginx.conf"
@ -108,8 +108,6 @@ ynh_system_user_create $app
# SPECIFIC UPGRADE # 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" ynh_backup_if_checksum_is_different "$final_path/config.yml"
cp ../conf/config.yml "$final_path/config.yml" cp ../conf/config.yml "$final_path/config.yml"
@ -129,6 +127,7 @@ ynh_store_file_checksum "$final_path/config.yml"
#================================================= #=================================================
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_replace_string "__ARCHITECTURE__" $architecture "../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
#================================================= #=================================================
@ -150,6 +149,12 @@ fi
# check data directory permission # check data directory permission
chown -R $app: $final_path/data chown -R $app: $final_path/data
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
@ -172,8 +177,12 @@ systemctl restart $app
#================================================= #=================================================
# RELOAD NGINX # 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
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression --message="Upgrade of $app completed" --last