diff --git a/scripts/restore b/scripts/restore index 2ceb02e..d3b022a 100755 --- a/scripts/restore +++ b/scripts/restore @@ -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