+@task
+def list_local_mods(c):
+ c.run(f'ls -al {LOCAL_LUANTI}/mods')
+
+@task
+def push_local_mod(c, mod):
+ tarfile = f'{LOCAL_BACKUPS}/mods/{mod}.tar'
+ print(f'Compressing local mod {mod} to {tarfile}')
+ c.run(f'tar cf {tarfile} --directory={LOCAL_LUANTI}/mods {mod}')
+ c.run(f'tar --list -f {tarfile} | tail')
+ c.run(f'tar --list -f {tarfile} | wc')
+
+ print(f'Pushing {tarfile} to {USER_AT_IP}:/tmp')
+ c.run(f'scp {tarfile} {USER_AT_IP}:/tmp')
+ c.run(f'{SSH} -C ls /tmp | grep {mod}')
+
+ print(f'Unpacking {mod}.tar...')
+ c.run(f'{SSH} -C tar xf /tmp/{mod}.tar --directory {MODS}')
+ c.run(f'{SSH} -C ls -l {MODS} | grep {mod}')
+ c.run(f'{SSH} -C ls -l {MODS}/{mod}')
+
+ print(f'Enable {mod} in config')
+ print(f'Remember to enable {mod} in config (invoke enable-mod {mod})')
+
+@task
+def enable_mod(c, mod):
+ enable_line = f'load_mod_{mod} = mods/{mod}'
+ result = c.run(f'{SSH} -C cat {WORLD_CONF} | grep {mod} &2>/dev/null')
+ print(result.stdout)
+ if(not mod in result.stdout):
+ print(f'Mod {mod} not found in {WORLD_CONF}. Adding.')
+ c.run(f'{SSH} -C "echo {enable_line} >> {WORLD_CONF}"')
+ else:
+ print(f'{MOD} already enabled in {WORLD_CONF}')
+ print(f'Grep result: {result.stdout}')
+ print("Remember to restart the server (invoke serve)!")