1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minetest_ynh.git synced 2024-09-03 20:36:00 +02:00
This commit is contained in:
Kay0u 2019-10-24 11:11:14 +09:00
parent 3893251f71
commit 7ec48847dc
No known key found for this signature in database
GPG key ID: 7FF262C033518333
6 changed files with 27 additions and 10 deletions

View file

@ -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)."

View file

@ -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

View file

@ -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"

View file

@ -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

View file

@ -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"
#=================================================

View file

@ -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
}