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:
ericgaspar 2020-12-03 11:33:58 +01:00
parent e9bb6f0b64
commit cb211c9a88
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 12 additions and 16 deletions

View file

@ -187,7 +187,7 @@ ynh_use_logrotate
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/minetest.log" --needs_exposed_ports="$port"
yunohost service add $app --description="Voxel game engine and game" --log="/var/log/$app/$app.log" --needs_exposed_ports="$port"
#=================================================
# 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
@ -27,11 +27,10 @@ creative=$(ynh_app_setting_get --app=$app --key=creative)
damage=$(ynh_app_setting_get --app=$app --key=damage)
servername=$(ynh_app_setting_get --app=$app --key=servername)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_print_info --message="Checking version..."
ynh_script_progression --message="Checking version..."
version=ynh_app_upstream_version
if [ "$version" = "0.01" ]; then
@ -39,7 +38,7 @@ ynh_die --message="You can't upgrade to this version with simple upgrade. Please
fi
ynh_print_info --message="Ensuring downward compatibility..."
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
@ -59,7 +58,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_print_info --message="Backing up the app before upgrading (may take a while)..."
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
@ -77,7 +76,7 @@ ynh_abort_if_errors
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_print_info --message="Upgrading source files..."
ynh_script_progression --message="Upgrading source files..."
# Remove old install
ynh_secure_remove --file="$final_path"
@ -88,14 +87,14 @@ ynh_setup_source --dest_dir="$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_print_info --message="Upgrading dependencies..."
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_print_info --message="Making sure dedicated system user exists..."
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$home_path --use_shell
@ -103,7 +102,7 @@ ynh_system_user_create --username=$app --home_dir=$home_path --use_shell
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_print_info --message="Upgrading systemd configuration..."
ynh_script_progression --message="Upgrading systemd configuration..."
# Create a dedicated systemd config
ynh_add_systemd_config
@ -152,9 +151,6 @@ ynh_backup_if_checksum_is_different --file="$home_path/.minetest/minetest.conf"
cp ../conf/minetest.conf $home_path/.minetest/minetest.conf
### `ynh_replace_string` is used to replace a string in a file.
### (It's compatible with sed regular expressions syntax)
ynh_replace_string --match_string="__GAME__" --replace_string="$game" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$home_path/.minetest/minetest.conf"
@ -170,7 +166,7 @@ ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf"
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_print_info --message="Upgrading logrotate configuration..."
ynh_script_progression --message="Upgrading logrotate configuration..."
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
@ -194,7 +190,7 @@ yunohost service add $app --description="Voxel game engine and game" --log="/var
#=================================================
# RELOAD MINETEST
#=================================================
ynh_print_info --message="Restarting Minetest..."
ynh_script_progression --message="Restarting Minetest..."
ynh_systemd_action --service_name=$app --action="restart" --log_path="/var/log/$app/minetest.log" --line_match="listening on"
@ -202,4 +198,4 @@ ynh_systemd_action --service_name=$app --action="restart" --log_path="/var/log/$
# END OF SCRIPT
#=================================================
ynh_print_info --message="Upgrade of $app completed"
ynh_script_progression --message="Upgrade of $app completed"