1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/minetest_ynh.git synced 2024-09-03 20:36:00 +02:00
minetest_ynh/scripts/restore
2017-10-20 13:33:49 +02:00

63 lines
2 KiB
Bash
Executable file

#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
#=================================================
# GENERIC STARTING
#=================================================
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
if [ ! -e _common.sh ]; then
# Get the functions file if not present in the current directory
sudo cp ../settings/scripts/_common.sh ./_common.sh
sudo chmod a+rx _common.sh
fi
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
app=$YNH_APP_INSTANCE_NAME
pvp=$(ynh_app_setting_get $app pvp)
damage=$(ynh_app_setting_get $app damage)
domain=$(ynh_app_setting_get $app domain)
creative=$(ynh_app_setting_get $app creative)
is_public=$(ynh_app_setting_get $app is_public)
#=================================================
# BACKUP STEPS
#=================================================
# STOP SERVICE
#=================================================
service minetest stop
#=================================================
# CONFIGURATION
#=================================================
ynh_restore_file "/etc/minetest/minetest.conf"
#=================================================
# DATA
#=================================================
ynh_restore_file "/var/games/minetest-server/"
ynh_restore_file "/tmp/map.sqlite"
echo ".restore /tmp/map.sqlite" | sqlite3 /var/games/minetest-server/.minetest/worlds/world/map.sqlite
#=================================================
# BACKUP OF APT PREFERENCES AND SOURCES.LIST
#=================================================
ynh_restore_file "/etc/apt/sources.list.d/$app.list"
ynh_restore_file "/etc/apt/preferences.d/00MinetestPinning"
#=================================================
# START SERVICE
#=================================================
service minetest start