at main 79 lines 2.5 kB view raw
1#! /usr/bin/env python3 2 3import os 4import subprocess 5 6import pubnix 7 8ARGS = [ 9 {'dn':'blinkenshell.org', 10 'ssh': 'ssh', 'port': 2222, 'web': 'u', 'sub': True}, 11 {'dn':'ctrl-c.club', 'sub': False}, 12 {'dn':'dimension.sh', 'sub': True}, 13 {'dn':'envs.net', 'sub': True}, 14 {'dn':'freeshell.de', 'sub': False}, 15 # {'dn':'hextilde.xyz', 'sub': True}, 16 {'dn':'insomnia247.nl', 'dir': True, 'sub': True}, 17 {'dn':'p.projectsegfau.lt', 'sub': True}, 18 # {'dn':'pubnix.pink', 'web': 'sites', 'sub': False}, 19 {'dn':'rawtext.club', 'sub': False}, 20 {'dn':'rw.rs', 'sub': False}, 21 {'dn':'thunix.net', 'sub': False}, 22 {'dn':'tilde.32bit.cafe', 'root': 'www', 'sub': False}, 23 {'dn':'tilde.cafe', 'sub': True}, 24 {'dn':'tilde.club', 'sub': False}, 25 {'dn':'tilde.fun', 'root': 'html', 'sub': False}, 26 {'dn':'tilde.green', 'sub': False}, 27 {'dn':'tilde.guru', 'sub': False}, 28 {'dn':'tilde.institute', 'sub': True}, 29 {'dn':'tilde.pink', 'sub': False}, 30 {'dn':'tilde.team', 'sub': True}, 31 {'dn':'tilde.town', 'sub': False}, 32 # {'dn':'trash.town', 'sub': False}, 33 # permissions 34 # {'dn':'sdf.org', 'root': 'html', 'sub': True}, 35 # old 36 {'dn':'fr.tild3.org', 'sub': True}, 37 {'dn':'remotes.club', 'port': 9022, 'root': 'web', 'sub': True}, 38 {'dn':'squiggle.city', 'sub': False}, 39 # down 40 # {'dn':'aussies.space', 'sub': False}, 41 # {'dn':'heathens.club', 'root': 'www', 'sub': False}, 42 # {'dn':'vern.cc', 'sub': True}, 43] 44PUBNIXES = [pubnix.PubNix(**args) for args in ARGS] 45 46 47def sync(root, pubnix, exclude=None): 48 args = [ 49 'rsync', 50 '--archive', 51 '--checksum', 52 '--delete-before', 53 '--rsh', f"ssh -o 'LogLevel Error' -p {pubnix.port}", 54 '--partial', 55 '--progress', 56 '--verbose', 57 os.path.join(root, str()), 58 ] 59 for item in exclude: 60 args.extend(['--exclude', os.path.join(str(), item)]) 61 args.append(os.path.join(pubnix.target, str())) 62 subprocess.call(args, stdout=subprocess.DEVNULL) 63 64 65def main(): 66 root = os.path.dirname(os.path.realpath(__file__)) 67 root = os.path.join(root, 'out', 'web') 68 dns_length = max([len(pubnix.dn) for pubnix in PUBNIXES]) 69 for pubnix in PUBNIXES: 70 print() 71 print(pubnix) 72 # print(f'{pubnix.dn.rjust(dns_length)} → ', end=str(), flush=True) 73 sync(root, pubnix, exclude=['__pycache__', 'pgp.asc']) 74 # print(pubnix.disk_free()) 75 # print(pubnix.os()) 76 77 78if __name__ == '__main__': 79 main()