1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/veloren_ynh.git synced 2024-09-03 17:46:10 +02:00

Fix linter

This commit is contained in:
Éric Gaspar 2023-01-18 22:28:08 +01:00
parent 098bea204a
commit 99c8ecb269
5 changed files with 48 additions and 44 deletions

View file

@ -3,8 +3,8 @@
"id": "veloren",
"packaging_format": 1,
"description": {
"en": "Multiplayer voxel RPG inspired by games such as Cube World, Legend of Zelda: Breath of the Wild, Dwarf Fortress and Minecraft",
"fr": "RPG voxel multijoueur inspiré de jeux tels que Cube World, Legend of Zelda : Breath of the Wild, Dwarf Fortress et Minecraft"
"en": "Multiplayer voxel RPG",
"fr": "RPG voxel multijoueur"
},
"version": "0.11.0~ynh1",
"url": "https://veloren.net",
@ -22,7 +22,7 @@
"email": "jules.bertholet@gmail.com"
},
"requirements": {
"yunohost": ">= 4.1.3"
"yunohost": ">= 11.0.9"
},
"multi_instance": true,
"services": [],

View file

@ -46,17 +46,18 @@ app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=10
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
data_path=/home/yunohost.app/$app
test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=10
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=server_name --value=$server_name
ynh_app_setting_set --app=$app --key=description --value=$description
@ -81,7 +82,7 @@ ynh_app_setting_set --app=$app --key=allow_inter_site_trade --value=$allow_inter
#=================================================
# FIND AND OPEN PORTS
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=10
ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=$(ynh_find_port --port=14004)
@ -95,20 +96,20 @@ ynh_app_setting_set --app=$app --key=metrics_port --value=$metrics_port
# Expose port publicly
# Open the port
ynh_script_progression --message="Configuring firewall..." --weight=10
ynh_script_progression --message="Configuring firewall..." --weight=1
ynh_exec_warn_less yunohost firewall allow --no-upnp Both $port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=20
ynh_script_progression --message="Installing dependencies..." --weight=2
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=10
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$data_path"
@ -116,7 +117,7 @@ ynh_system_user_create --username=$app --home_dir="$data_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=100
ynh_script_progression --message="Setting up source files..." --weight=10
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
@ -128,7 +129,7 @@ setup_source
#=================================================
# COMPILE SERVER
#=================================================
ynh_script_progression --message="Compiling server..." --weight=100
ynh_script_progression --message="Compiling server..." --weight=10
compile_server
@ -139,7 +140,7 @@ compile_server
map_generated=0
if [ $generate_custom_world -eq 1 ]; then
ynh_script_progression --message="Generating custom world..." --weight=100
ynh_script_progression --message="Generating custom world..." --weight=10
generate_custom_world
fi
@ -153,7 +154,7 @@ add_configuration_files
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=10
ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
@ -163,7 +164,7 @@ ynh_add_systemd_config
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=10
ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
@ -171,14 +172,14 @@ ynh_use_logrotate
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=10
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Veloren game server" --needs_exposed_ports "$port" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=35
ynh_script_progression --message="Starting a systemd service..." --weight=10
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --line_match="Server is ready to accept connections." --log_path="/var/log/$app/$app.log"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=10
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -27,14 +27,14 @@ get_app_settings
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=10
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=100
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=5
# Remove the dedicated systemd config
ynh_remove_systemd_config
@ -42,7 +42,7 @@ ynh_remove_systemd_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=10
ynh_script_progression --message="Removing dependencies..." --weight=5
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
@ -50,7 +50,7 @@ ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=10
ynh_script_progression --message="Removing app main directory..." --weight=3
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -58,15 +58,18 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE APP DATA DIR
#=================================================
ynh_script_progression --message="Removing app data directory..." --weight=10
# Remove the data directory securely
ynh_secure_remove --file="$data_path"
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..." --weight=1
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Removing logrotate configuration..." --weight=10
ynh_script_progression --message="Removing logrotate configuration..." --weight=5
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -77,7 +80,7 @@ ynh_remove_logrotate
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..." --weight=10
ynh_script_progression --message="Closing port $port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi

View file

@ -23,7 +23,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=10
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -32,7 +32,7 @@ get_app_settings
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=10
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
@ -44,7 +44,7 @@ test ! -d $data_path \
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=10
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$data_path"
@ -52,7 +52,7 @@ ynh_system_user_create --username=$app --home_dir="$data_path"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=15
ynh_script_progression --message="Reinstalling dependencies..." --weight=6
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
@ -60,7 +60,7 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=10
ynh_script_progression --message="Restoring the app main directory..." --weight=4
ynh_restore_file --origin_path="$final_path"
@ -79,7 +79,7 @@ ynh_restore_file --origin_path="/var/log/$app"
#=================================================
# RESTORE SYSTEMD
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=10
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
@ -87,7 +87,7 @@ systemctl enable $app.service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=10
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Veloren game server" --needs_exposed_ports "$port" --log="/var/log/$app/$app.log"

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=10
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -27,7 +27,7 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
@ -45,14 +45,14 @@ ynh_abort_if_errors
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=10
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"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=10
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$data_path"
@ -60,7 +60,7 @@ ynh_system_user_create --username=$app --home_dir="$data_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=10
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
@ -70,7 +70,7 @@ ynh_install_app_dependencies $pkg_dependencies
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=100
ynh_script_progression --message="Upgrading source files..." --weight=10
# Download, check integrity, uncompress and patch the source from app.src
setup_source
@ -81,7 +81,7 @@ fi
#=================================================
# COMPILE SERVER
#=================================================
ynh_script_progression --message="Compiling server..." --weight=100
ynh_script_progression --message="Compiling server..." --weight=10
compile_server
@ -92,7 +92,7 @@ compile_server
map_generated=0
if [ $generate_custom_world -eq 1 ]; then
ynh_script_progression --message="Generating custom world..." --weight=100
ynh_script_progression --message="Generating custom world..." --weight=10
generate_custom_world
fi
@ -106,7 +106,7 @@ add_configuration_files
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=10
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
@ -116,7 +116,7 @@ ynh_add_systemd_config
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=10
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
@ -131,7 +131,7 @@ yunohost service add $app --description="Veloren game server" --needs_exposed_po
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=35
ynh_script_progression --message="Starting a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action="start" --line_match="Server is ready to accept connections." --log_path="/var/log/$app/$app.log"