]> apps.delaporte.us Git - dotfiles.git/blobdiff - invoke/luanti/tasks.py
WIP luanti backups
[dotfiles.git] / invoke / luanti / tasks.py
index 14636ade9598e16fa3eb51242407d1cb20e5349f..f2adcfd1042e60567cb244898266fb4690bacb73 100644 (file)
@@ -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"
 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"  
 
 # 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
     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
     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")
 
     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):
 
 @task
 def status(c):
@@ -135,6 +121,15 @@ def logs(c, lines=20):
     c.run(f"tail -n {lines} {root}/debug.txt")
 
 @task
     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'):
 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")
 
     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")
 @task
 def checkdb(c):
     c.run(f"{scripts}/check_db.sh")