1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cowyo_ynh.git synced 2024-09-03 18:16:15 +02:00

Fix linter warnings

This commit is contained in:
ericgaspar 2021-02-07 11:53:00 +01:00 committed by tituspijean
parent 9179ea4dda
commit 544df05439
8 changed files with 39 additions and 115 deletions

View file

@ -1,8 +1,6 @@
# See here for more information
# 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)
@ -19,13 +17,8 @@
upgrade=1 from_commit=d2e712af6ed33c1afeed4b60fcd8902409f8c2a8
backup_restore=1
multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0
change_url=1
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
Email=
Notification=none

View file

@ -3,8 +3,8 @@
"id": "cowyo",
"packaging_format": 1,
"description": {
"en": "A feature-rich wiki webserver for minimalists.",
"fr": "Un serveur de wiki minimaliste mais riche en fonctionnalités."
"en": "Feature-rich wiki webserver for minimalists",
"fr": "Serveur de wiki minimaliste mais riche en fonctionnalités."
},
"version": "2.12.0~ynh4",
"url": "https://github.com/schollz/cowyo",
@ -14,7 +14,7 @@
"email": "tituspijean@outlook.com"
},
"requirements": {
"yunohost": ">= 3.7"
"yunohost": ">= 3.8.2"
},
"multi_instance": true,
"services": [
@ -25,8 +25,8 @@
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain name dedicated to cowyo.",
"fr": "Choisissez un nom de domaine dédié à cowyo."
"en": "Choose a domain name dedicated to Cowyo",
"fr": "Choisissez un nom de domaine dédié à Cowyo"
},
"example": "example.com"
},
@ -38,8 +38,8 @@
"fr": "Est-ce une application publique ?"
},
"help": {
"en": "If public, anyone will be able to create pages in cowyo.",
"fr": "Si publique, quiconque pourra créer des pages dans cowyo."
"en": "If public, anyone will be able to create pages in Cowyo",
"fr": "Si publique, quiconque pourra créer des pages dans Cowyo"
},
"default": true
}

View file

@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -32,25 +32,19 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=2
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
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=1
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..." --weight=1
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -59,26 +53,17 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_script_progression --message="Backing up logrotate configuration..." --weight=1
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_script_progression --message="Backing up systemd configuration..." --weight=1
ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -28,10 +28,6 @@ app=$YNH_APP_INSTANCE_NAME
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get $app final_path)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get "$app" db_name)
#db_pwd=$(ynh_app_setting_get $app db_pwd)
#=================================================
# CHECK THE SYNTAX OF THE PATHS
#=================================================
@ -87,16 +83,15 @@ then
ynh_store_file_checksum "/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# SPECIFIC MODIFICATIONS
#=================================================
# ...
#=================================================
#=================================================
# GENERIC FINALISATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
systemctl reload nginx
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -46,8 +46,8 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set $app domain $domain
ynh_app_setting_set $app path $path_url
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
@ -73,7 +73,7 @@ chmod +x "$final_path/cowyo"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..." --weight=1
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
@ -118,7 +118,7 @@ ynh_use_logrotate
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add ${app} --log "/var/log/${app}.log"
yunohost service add $app --description="wiki webserver" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
@ -126,7 +126,7 @@ yunohost service add ${app} --log "/var/log/${app}.log"
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app"
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app"
#=================================================
# SETUP PERMISSIONS
@ -138,13 +138,13 @@ if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -52,7 +52,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=1
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config
ynh_remove_nginx_config
@ -65,16 +65,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight=
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================

View file

@ -78,20 +78,20 @@ chown -R $app: $final_path
ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
systemctl enable $app.service --quiet
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app --log "/var/log/$app/$app.log"
yunohost service add $app --description="wiki webserver" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
@ -104,9 +104,8 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================

View file

@ -25,12 +25,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
# CHECK VERSION
#=================================================
### This helper will compare the version of the currently installed app and the version of the upstream package.
### $upgrade_type can have 2 different values
### - UPGRADE_APP if the upstream app version has changed
### - UPGRADE_PACKAGE if only the YunoHost package has changed
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
@ -45,31 +39,12 @@ if [ -z "$final_path" ]; then
fi
# Cleaning legacy permissions
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
skipped_uris=$(ynh_app_setting_get --app=$app --key=skipped_uris)
unprotected_uris=$(ynh_app_setting_get --app=$app --key=unprotected_uris)
protected_uris=$(ynh_app_setting_get --app=$app --key=protected_uris)
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
# Remove is_public if exists
if [ ! -z "$is_public" ]; then
ynh_app_setting_delete --app=$app --key=is_public
fi
# Remove skipped_uris if exists
if [ ! -z "$skipped_uris" ]; then
ynh_app_setting_delete --app=$app --key=skipped_uris
fi
# Remove unprotected_uris if exists
if [ ! -z "$unprotected_uris" ]; then
ynh_app_setting_delete --app=$app --key=unprotected_uris
fi
# Remove protected_uris if exists
if [ ! -z "$protected_uris" ]; then
ynh_app_setting_delete --app=$app --key=protected_uris
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -84,18 +59,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
# N.B. : this is for app installations before YunoHost 2.7
# where this value might be something like /foo/ or foo/
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -103,7 +66,7 @@ path_url=$(ynh_normalize_url_path --path_url=$path_url)
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -122,7 +85,7 @@ fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
ynh_add_nginx_config
@ -164,23 +127,22 @@ ynh_add_systemd_config
chown -R $app: $final_path
#=================================================
# SETUP PERMISSIONS
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
#ynh_script_progression --message="Upgrading permissions configuration..." --weight=1
yunohost service add $app --description="wiki webserver" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..." --weight=1
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload