diff --git a/scripts/backup b/scripts/backup index f81bbf5..62d8e57 100755 --- a/scripts/backup +++ b/scripts/backup @@ -14,6 +14,10 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action +} + # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -33,7 +37,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) # BACKUP THE APP MAIN DIR #================================================= # Stop Minetest before backup... -systemctl stop $app +ynh_systemd_action --action=stop ynh_print_info --message="Backing up the main app directory..." @@ -66,6 +70,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" # END OF SCRIPT #================================================= # Restart Minetest -systemctl start $app +ynh_systemd_action --action=start --line_match="Server for gameid=\"$app\" listening on :::30000." --log_path="/var/log/$app/minetest.log" ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index eb018a3..d1f8c37 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -50,7 +50,7 @@ change_path=0 # SPECIFIC MODIFICATIONS #================================================= ynh_print_info --message="Stop Minetest..." -systemctl stop $app +ynh_systemd_action --action=restart ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" --target_file="/home/yunohost.app/$app/.minetest/minetest.conf" #================================================= @@ -60,7 +60,7 @@ ynh_replace_string --match_string="$old_domain" --replace_string="$new_domain" - #================================================= ynh_print_info --message="Reloading Minetest..." -systemctl restart $app +ynh_systemd_action --action=restart --line_match="Server for gameid=\"$app\" listening on :::30000." --log_path="/var/log/$app/minetest.log" #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index e7c6e96..00c1a05 100755 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,10 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action +} + # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -38,6 +42,7 @@ servername=$YNH_APP_ARG_SERVERNAME ### guaranteed to be unique. This is a good unique identifier to define installation path, ### db names, ... app=$YNH_APP_INSTANCE_NAME +path_url="/" #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS @@ -50,7 +55,7 @@ final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" # Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url="/" +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST @@ -58,6 +63,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url="/" ynh_print_info --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=pvp --value=$pvp ynh_app_setting_set --app=$app --key=creative --value=$creative @@ -198,7 +204,7 @@ fi # Set permissions on logs chown -R $app:$app /var/log/$app -systemctl start $app +ynh_systemd_action --action=start #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -253,7 +259,7 @@ ynh_use_logrotate ### - Remove the section "REMOVE SERVICE FROM ADMIN PANEL" in the remove script ### - As well as the section "ADVERTISE SERVICE IN ADMIN PANEL" in the restore script -yunohost service add $app --log "/var/log/$app/$app.log" +yunohost service add $app --log "/var/log/$app/minetest.log" # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added #yunohost service add $app --description "$app daemon for XXX" --log "/var/log/$app/$app.log" diff --git a/scripts/remove b/scripts/remove index 2ddd271..898aeb0 100755 --- a/scripts/remove +++ b/scripts/remove @@ -56,7 +56,7 @@ ynh_print_info --message="Removing app main directory" # Remove the app directory securely ynh_secure_remove --file="$final_path" -ynh_secure_remove --file="/home/yunohost.app/$app/" +ynh_secure_remove --file="/home/yunohost.app/$app" #================================================= # REMOVE LOGROTATE CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 5b65c32..571b705 100755 --- a/scripts/restore +++ b/scripts/restore @@ -14,6 +14,10 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action +} + # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -25,6 +29,7 @@ ynh_print_info --message="Loading settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) +path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= @@ -32,7 +37,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= ynh_print_info --message="Validating restoration parameters..." -ynh_webpath_register --app=$app --domain=$domain --path_url="/" +ynh_webpath_available --app=$app --domain=$domain --path_url=$path_url test ! -d $final_path \ || ynh_die --message="There is already a directory: $final_path " @@ -88,7 +93,7 @@ systemctl enable $app.service # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --log "/var/log/$app/$app.log" +yunohost service add $app --log "/var/log/$app/minetest.log" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 33cdd44..b5b9211 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -64,6 +64,8 @@ ynh_print_info --message="Backing up the app before upgrading (may take a while) # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Need for the param line_match of ynh_systemd_action + # restore it if the upgrade fails ynh_restore_upgradebackup }