X-Git-Url: https://apps.delaporte.us/gitweb/dotfiles.git/blobdiff_plain/2dab8236a1f3c719b54417a3e1b462e755bba9f0..8f1cee401a363513bddbda61863311debc25d38c:/invoke/luanti/tasks.py diff --git a/invoke/luanti/tasks.py b/invoke/luanti/tasks.py index 14636ad..f2adcfd 100644 --- a/invoke/luanti/tasks.py +++ b/invoke/luanti/tasks.py @@ -10,7 +10,7 @@ mod_dir = f"{root}/mods" easy_dir = f"{home}/minetest/" run_mt = f"flatpak run net.minetest.Minetest" world_dir = f"{root}/worlds" -scripts = f"{home}/ansible/luanti" +scripts = f"{home}/ansible/luanti/remote" # flatpak link_to = f"{home}/.var/app/net.minetest.Minetest/.minetest" @@ -36,7 +36,7 @@ def install(c): print("To run: flatpak run net.minetest.Minetest") @task -def restore(c, dir): +def restore_remote(c, dir): if not os.path.isdir(dir): print(f"No backups found at {dir}") return @@ -48,20 +48,6 @@ def restore(c, dir): c.run(f"mv {dir}/* {world_folder}") print("Finished") -# DONT - flatpak hates symlinks -def link(c): - # c.run(f"ls -al {link_to}") - if os.path.isdir(link_to): - print("Moving existing files...") - c.run(f"mv {link_to} {easy_dir}") - if not os.path.isdir(easy_dir): - raise ValueError(f"{easy_dir} not found.") - if os.path.exists(link_to): - print(f"Doing nothing. {link_to} exists.") - if os.path.isdir(easy_dir) and not os.path.exists(link_to): - print("Linking...") - c.run(f"ln -s {easy_dir} {link_to}") - # c.run(f"ls -al {link_to}") @task def status(c): @@ -135,6 +121,15 @@ def logs(c, lines=20): c.run(f"tail -n {lines} {root}/debug.txt") @task +def backup_remote(c): + stopped = input("Is the server stopped?") + if(stopped != 'y'): + print("so go stop the server...") + exit() + print("okay...backing up.") + c.run(f"{scripts}/do_luanti.sh {scripts}/backup.sh") + c.run(f"{scripts}/check_db.sh") + def backup(c): stopped = input("Is the server stopped?") if(stopped != 'y'): @@ -144,6 +139,7 @@ def backup(c): c.run(f"{scripts}/do_luanti.sh {scripts}/backup.sh") c.run(f"{scripts}/check_db.sh") + @task def checkdb(c): c.run(f"{scripts}/check_db.sh")