1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minetest_ynh.git synced 2024-09-03 20:36:00 +02:00

Add_config

This commit is contained in:
ericgaspar 2021-04-17 19:56:32 +02:00
parent 6f7dca362a
commit 56e1128f88
No known key found for this signature in database
GPG key ID: 574F281483054D44
2 changed files with 20 additions and 34 deletions

View file

@ -138,16 +138,15 @@ popd
### `ynh_replace_string` is used to replace a string in a file.
### (It's compatible with sed regular expressions syntax)
# Install the game
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"
ynh_replace_string --match_string="__SERVERNAME__" --replace_string="$servername" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__ANNOUNCE__" --replace_string="$is_public" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__PVP__" --replace_string="$pvp" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__CREATIVE__" --replace_string="$creative" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DAMAGE__" --replace_string="$damage" --target_file="$home_path/.minetest/minetest.conf"
if [ $is_public = 1 ]; then
annouce = "true"
else
annouce = "fase"
fi
ynh_add_config --template="../conf/minetest.conf" --destination="$home_path/.minetest/minetest.conf"
#=================================================
# CREATE WORLD

View file

@ -78,7 +78,7 @@ ynh_script_progression --message="Upgrading source files..."
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --time --weight=1
ynh_script_progression --message="Upgrading source files..." --weight=1
# Remove old install
ynh_secure_remove --file="$final_path"
@ -87,11 +87,6 @@ then
ynh_setup_source --dest_dir="$final_path"
fi
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -120,11 +115,11 @@ ynh_add_systemd_config
#=================================================
if [ -e $home_path ]
then
echo "Nothing to do..."
else
mkdir -p $home_path/.minetest/
mkdir $home_path/.minetest/worlds/
then
echo "Nothing to do..."
else
mkdir -p $home_path/.minetest/
mkdir $home_path/.minetest/worlds/
fi
#=================================================
@ -155,21 +150,13 @@ popd
# MODIFY A CONFIG FILE
#=================================================
ynh_backup_if_checksum_is_different --file="$home_path/.minetest/minetest.conf"
if [ $is_public = 1 ]; then
annouce = "true"
else
annouce = "fase"
fi
cp ../conf/minetest.conf $home_path/.minetest/minetest.conf
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"
ynh_replace_string --match_string="__SERVERNAME__" --replace_string="$servername" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__ANNOUNCE__" --replace_string="$is_public" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__PVP__" --replace_string="$pvp" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__CREATIVE__" --replace_string="$creative" --target_file="$home_path/.minetest/minetest.conf"
ynh_replace_string --match_string="__DAMAGE__" --replace_string="$damage" --target_file="$home_path/.minetest/minetest.conf"
ynh_store_file_checksum --file="$home_path/.minetest/minetest.conf"
ynh_add_config --template="../conf/minetest.conf" --destination="$home_path/.minetest/minetest.conf"
#=================================================
# SETUP LOGROTATE