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

Merge branch 'testing' into master

This commit is contained in:
Clément 2021-04-17 11:08:41 +02:00 committed by GitHub
commit db297a0dac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 74 additions and 55 deletions

View file

@ -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).

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)
[![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).

View file

@ -14,7 +14,7 @@
"email": "plopoyop@gmail.com"
},
"requirements": {
"yunohost": ">= 3.7.0"
"yunohost": ">= 3.8.1"
},
"multi_instance": true,
"services": [

View file

@ -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"

View file

@ -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
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)"

View file

@ -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

View file

@ -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
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last

View file

@ -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

View file

@ -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
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last