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

Fix linter

This commit is contained in:
ericgaspar 2020-12-03 11:19:43 +01:00
parent 0d82f0290e
commit af8d2020a5
No known key found for this signature in database
GPG key ID: 574F281483054D44
9 changed files with 45 additions and 48 deletions

View file

@ -75,8 +75,7 @@ How to configure this app: by SSH
---
Developers info
----------------
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/minetest_ynh/tree/testing).

View file

@ -74,8 +74,7 @@ Comment configurer cette application : par SSH
---
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/minetest_ynh/tree/testing).

View file

@ -52,11 +52,6 @@
incorrect_path=0
port_already_use=1
change_url=0
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options
Email=
Notification=none

View file

@ -48,6 +48,7 @@
},
{
"name": "game",
"type": "string",
"ask": {
"en": "Choose a game for your server",
"fr": "Choissisez un jeu pour votre serveur"

View file

@ -32,18 +32,19 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
home_path=$(ynh_app_setting_get --app=$app --key=home_path)
#=================================================
# 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_print_info --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE HOME DIR
#=================================================
ynh_print_info --message="Backing up Minetest data..."
ynh_backup --src_path="$home_path"
@ -52,14 +53,12 @@ ynh_backup --src_path="$home_path"
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_print_info --message="Backing up logrotate configuration..."
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_print_info --message="Backing up systemd configuration..."
ynh_backup --src_path="/etc/systemd/system/$app.service"

View file

@ -38,7 +38,7 @@ path_url="/"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_print_info --message="Validating installation parameters..."
ynh_script_progression --message="Validating installation parameters..."
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
@ -46,7 +46,7 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_print_info --message="Storing installation settings..."
ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=server_domain --value=$server_domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
@ -62,7 +62,7 @@ ynh_app_setting_set --app=$app --key=servername --value=$servername
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_print_info --message="Configuring firewall..."
ynh_script_progression --message="Configuring firewall..."
# Find a free port
port=$(ynh_find_port 30000)
@ -73,14 +73,14 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Installing dependencies..."
ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info --message="Setting up source files..."
ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
@ -89,7 +89,7 @@ ynh_setup_source --dest_dir="$final_path"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Configuring system user..."
ynh_script_progression --message="Configuring system user..."
home_path=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=home_path --value=$home_path
@ -107,7 +107,7 @@ cp -a ../conf/minetest.conf $home_path/.minetest/
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info --message="Configuring a systemd service..."
ynh_script_progression --message="Configuring a systemd service..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -149,7 +149,6 @@ ynh_replace_string --match_string="__PVP__" --replace_string="$pvp" --target_fil
ynh_replace_string --match_string="__CREATIVE__" --replace_string="$creative" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DAMAGE__" --replace_string="$damage" --target_file="$home_path/.minetest/minetest.conf"
#=================================================
# CREATE WORLD
#=================================================
@ -179,7 +178,7 @@ chown -R $app: $home_path
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info --message="Configuring log rotation..."
ynh_script_progression --message="Configuring log rotation..."
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
@ -188,7 +187,7 @@ ynh_use_logrotate
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app --log "/var/log/$app/minetest.log"
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/minetest.log" --needs_exposed_ports
#=================================================
# RELOAD MINETEST

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
@ -29,14 +29,14 @@ home_path=$(ynh_app_setting_get --app=$app --key=home_path)
# Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status $app >/dev/null 2>&1
then
ynh_print_info --message="Removing $app service"
ynh_script_progression --message="Removing $app service"
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_print_info --message="Stopping and removing the systemd service"
ynh_script_progression --message="Stopping and removing the systemd service"
# Remove the dedicated systemd config
ynh_remove_systemd_config
@ -44,7 +44,7 @@ ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_print_info --message="Removing dependencies"
ynh_script_progression --message="Removing dependencies"
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -52,7 +52,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_print_info --message="Removing app main directory"
ynh_script_progression --message="Removing app main directory"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -64,7 +64,7 @@ ynh_secure_remove "/var/log/$app"
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_print_info --message="Removing logrotate configuration"
ynh_script_progression --message="Removing logrotate configuration"
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -75,20 +75,16 @@ ynh_remove_logrotate
if yunohost firewall list | grep -q "\- $port$"
then
ynh_print_info --message="Closing port $port"
ynh_script_progression --message="Closing port $port"
ynh_exec_warn_less yunohost firewall disallow UDP $port
fi
#=================================================
# SPECIFIC REMOVE
#=================================================
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_print_info --message="Removing the dedicated system user"
ynh_script_progression --message="Removing the dedicated system user"
# Delete a system user
ynh_system_user_delete --username=$app
@ -97,4 +93,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_print_info --message="Removal of $app completed"
ynh_script_progression --message="Removal of $app completed"

View file

@ -24,7 +24,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading settings..."
ynh_script_progression --message="Loading settings..."
app=$YNH_APP_INSTANCE_NAME
@ -34,19 +34,17 @@ home_path=$(ynh_app_setting_get --app=$app --key=home_path)
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_print_info --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info --message="Recreating the dedicated system user..."
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$home_path --use_shell
@ -67,7 +65,7 @@ chown -R $app: $home_path
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_print_info --message="Reinstalling dependencies..."
ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
@ -75,10 +73,10 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_print_info --message="Restoring the systemd configuration..."
ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service
systemctl enable $app.service --quiet
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
@ -87,7 +85,12 @@ systemctl enable $app.service
mkdir /var/log/$app -p
chown -R $app: /var/log/$app
yunohost service add $app --log "/var/log/$app/minetest.log"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log"
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
@ -100,7 +103,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# RELOAD MINETEST
#=================================================
ynh_print_info --message="Reloading minetest..."
ynh_script_progression --message="Reloading minetest..."
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/minetest.log" --line_match="listening on"
@ -108,4 +111,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap
# END OF SCRIPT
#=================================================
ynh_print_info --message="Restoration completed for $app"
ynh_script_progression --message="Restoration completed for $app"

View file

@ -185,6 +185,12 @@ ynh_use_logrotate --non-append
chown -R root: $final_path
chown -R $app: $home_path
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/minetest.log"
#=================================================
# RELOAD MINETEST
#=================================================