diff --git a/scripts/install b/scripts/install index fe5fe43..f4c2f44 100755 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." --weight=1 +ynh_script_progression --message="Validating installation parameters..." --weight=10 final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -56,7 +56,7 @@ 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=1 +ynh_script_progression --message="Storing installation settings..." --weight=10 ynh_app_setting_set --app=$app --key=server_name --value=$server_name ynh_app_setting_set --app=$app --key=description --value=$description @@ -81,7 +81,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=1 +ynh_script_progression --message="Finding an available port..." --weight=10 # Find an available port port=$(ynh_find_port --port=14004) @@ -95,7 +95,7 @@ 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=1 +ynh_script_progression --message="Configuring firewall..." --weight=10 ynh_exec_warn_less yunohost firewall allow --no-upnp Both $port #================================================= @@ -108,7 +108,7 @@ ynh_install_app_dependencies $pkg_dependencies #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=10 # Create a system user ynh_system_user_create --username=$app --home_dir="$data_path" @@ -116,7 +116,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=155 +ynh_script_progression --message="Setting up source files..." --weight=100 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 +128,7 @@ setup_source #================================================= # COMPILE SERVER #================================================= -ynh_script_progression --message="Compiling server..." --weight=135 +ynh_script_progression --message="Compiling server..." --weight=100 compile_server @@ -139,7 +139,7 @@ compile_server map_generated=0 if [ $generate_custom_world -eq 1 ]; then - ynh_script_progression --message="Generating custom world..." --weight=730 + ynh_script_progression --message="Generating custom world..." --weight=100 generate_custom_world fi @@ -153,17 +153,17 @@ add_configuration_files #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 +ynh_script_progression --message="Configuring a systemd service..." --weight=10 # Create a dedicated systemd config -ynh_add_systemd_config --others_var="data_path" +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 +ynh_script_progression --message="Configuring log rotation..." --weight=10 # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -171,7 +171,7 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=10 yunohost service add $app --description="Veloren game server" --needs_exposed_ports "$port" --log="/var/log/$app/$app.log" diff --git a/scripts/remove b/scripts/remove index 1bfe044..d3602c2 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=10 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=1 + ynh_script_progression --message="Removing $app service integration..." --weight=10 yunohost service remove $app fi #================================================= # STOP AND REMOVE SERVICE #================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=120 +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=100 # Remove the dedicated systemd config ynh_remove_systemd_config @@ -50,7 +50,7 @@ ynh_remove_app_dependencies #================================================= # REMOVE APP MAIN DIR #================================================= -ynh_script_progression --message="Removing app main directory..." --weight=1 +ynh_script_progression --message="Removing app main directory..." --weight=10 # Remove the app directory securely ynh_secure_remove --file="$final_path" @@ -58,7 +58,7 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE APP DATA DIR #================================================= -ynh_script_progression --message="Removing app data directory..." --weight=1 +ynh_script_progression --message="Removing app data directory..." --weight=10 # Remove the data directory securely ynh_secure_remove --file="$data_path" @@ -66,7 +66,7 @@ ynh_secure_remove --file="$data_path" #================================================= # REMOVE LOGROTATE CONFIGURATION #================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 +ynh_script_progression --message="Removing logrotate configuration..." --weight=10 # Remove the app-specific logrotate config ynh_remove_logrotate @@ -77,7 +77,7 @@ ynh_remove_logrotate if yunohost firewall list | grep -q "\- $port$" then - ynh_script_progression --message="Closing port $port..." --weight=1 + ynh_script_progression --message="Closing port $port..." --weight=10 ynh_exec_warn_less yunohost firewall disallow TCP $port fi @@ -95,7 +95,7 @@ ynh_secure_remove --file="/var/log/$app" #================================================= # REMOVE DEDICATED USER #================================================= -ynh_script_progression --message="Removing the dedicated system user..." --weight=1 +ynh_script_progression --message="Removing the dedicated system user..." --weight=10 # Delete a system user ynh_system_user_delete --username=$app diff --git a/scripts/restore b/scripts/restore index 51ae125..65fc178 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=10 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=1 +ynh_script_progression --message="Validating restoration parameters..." --weight=10 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=1 +ynh_script_progression --message="Recreating the dedicated system user..." --weight=10 # Create the dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$data_path" @@ -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=1 +ynh_script_progression --message="Restoring the app main directory..." --weight=10 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=1 +ynh_script_progression --message="Restoring the systemd configuration..." --weight=10 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet @@ -87,14 +87,14 @@ systemctl enable $app.service --quiet #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=10 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=1 +ynh_script_progression --message="Starting a systemd service..." --weight=10 ynh_systemd_action --service_name=$app --action="start" --line_match="Server is ready to accept connections." --log_path="/var/log/$app/$app.log" diff --git a/scripts/upgrade b/scripts/upgrade index 90dfcc1..5d09a83 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=10 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=1 +ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=10 # 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=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=10 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=1 +ynh_script_progression --message="Making sure dedicated system user exists..." --weight=10 # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$data_path" @@ -70,7 +70,7 @@ ynh_install_app_dependencies $pkg_dependencies if [ "$upgrade_type" == "UPGRADE_APP" ] then - ynh_script_progression --message="Upgrading source files..." --weight=155 + ynh_script_progression --message="Upgrading source files..." --weight=100 # 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=135 +ynh_script_progression --message="Compiling server..." --weight=100 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=730 + ynh_script_progression --message="Generating custom world..." --weight=100 generate_custom_world fi @@ -106,17 +106,17 @@ add_configuration_files #================================================= # SETUP SYSTEMD #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 +ynh_script_progression --message="Upgrading systemd configuration..." --weight=10 # Create a dedicated systemd config -ynh_add_systemd_config --others_var="data_path" +ynh_add_systemd_config #================================================= # GENERIC FINALIZATION #================================================= # SETUP LOGROTATE #================================================= -ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1 +ynh_script_progression --message="Upgrading logrotate configuration..." --weight=10 # Use logrotate to manage app-specific logfile(s) ynh_use_logrotate --non-append @@ -124,7 +124,7 @@ ynh_use_logrotate --non-append #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=10 yunohost service add $app --description="Veloren game server" --needs_exposed_ports "$port" --log="/var/log/$app/$app.log"