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

Fix restore script

This commit is contained in:
Luc Didry 2017-10-20 13:45:31 +02:00
parent b8f3e07594
commit 0b447d2c7e

View file

@ -33,31 +33,67 @@ 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
# RESTORE 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
# INSTALL
#=================================================
service minetest start
if [ $(uname -m) == "armv7l" ]
then
gpg --list-keys 7638D0442B90D010 > /dev/null 2>&1
if [ $? != 0 ]
then
gpg --keyserver pgpkeys.mit.edu --recv-key 7638D0442B90D010
fi
gpg --list-keys 8B48AD6246925553 > /dev/null 2>&1
if [ $? != 0 ]
then
gpg --keyserver pgpkeys.mit.edu --recv-key 8B48AD6246925553
fi
if [ $(apt-key finger | grep "7638 D044 2B90 D010" -c) == 0 ]
then
gpg -a --export 7638D0442B90D010 | apt-key add -
fi
if [ $(apt-key finger | grep "8B48 AD62 4692 5553" -c) == 0 ]
then
gpg -a --export 8B48AD6246925553 | apt-key add -
fi
fi
ynh_package_update
ynh_install_app_dependencies minetest-server sqlite3
#=================================================
# ENABLE SERVICE IN ADMIN PANEL
#=================================================
# Add service to Yunohost's monitoring
yunohost service add minetest --log "/var/log/minetest/minetest.log"
#=================================================
# STOP MINETEST
#=================================================
service minetest-server stop
#=================================================
# CONFIGURATION
#=================================================
ynh_secure_remove "/etc/minetest/minetest.conf"
ynh_restore_file "/etc/minetest/minetest.conf"
#=================================================
# DATA
#=================================================
ynh_secure_remove "/var/games/minetest-server/"
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
#=================================================
# START MINETEST
#=================================================
service minetest-server start