summaryrefslogtreecommitdiff
path: root/backend/update.py
blob: f97d0aa6bbda38fc9577aaf8049628473da92e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python2

import resilient
import resilient.freenet


####################### Instantiate hosts

hosts = []

zeronet_urls = ['http://bit.no.com:43110']
if resilient.zeronet.found:
  hosts.append(resilient.zeronet('1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4',
                                 '5JzZACCELsT4bx66qmV9JDaWhEQ6Sx6j7LzeucsxJGA9H7nuoRr'))
  zeronet_urls.append('http://127.0.0.1:43110')

ipfs_urls = ['https://ipfs.io']
if resilient.ipfs.found:
  ipfs_host = resilient.ipfs('ipfs-public')
  ipfs_urls.append(ipfs_host.gateway)
  hosts.append(ipfs_host)

if resilient.freenet.freesitemgr.found and resilient.freenet.running:
  hosts.append(resilient.freenet.freesitemgr()) # keys for freesitemgr are in auth/freesitemgr


##################### Instantiate remotes

git_repos = [
  resilient.git('git://standingwithresilience.branchable.com/'),
  resilient.git('fairlystable-guest:/srv/git/standingwithresilience'),
  resilient.git('https://gitlab.com/standingwithresilience/standingwithresilience.gitlab.io.git')
]

for host in zeronet_urls:
  git_repos.extend([
    #### public zeronet ####
    resilient.git('%s/1GtQ8bkFkhYtKerSdXHKe1z4j9VTmFR5d4/.git' % host, None),
    #### private zeronet ####
    resilient.git('%s/1L363bqJnCG63SnV83kfV7izZXbmentctD/.git' % host, None)
  ])

for host in ipfs_urls:
  git_repos.extend([
    #### public ipfs ####
    resilient.git('%s/ipns/QmPw1ZqrdEma823zTrnH9cVFF4j3YSeedrRjqPGj9Q8Utx/.git' % host, None),
    #### private ipfs ####
    resilient.git('%s/ipns/QmYMViYhjtwH2BkuHYRGJvPDWcXdNf2YcRFTTCzzqQGVn1/.git' % host, None)
  ])

if resilient.freenet.gitocalypse.found and resilient.freenet.running:
  git_repos.extend([
    #### public freenet ####
    resilient.freenet.gitocalypse('freenet://USK@hCLgfaINNSNAl4do-PapEincQP5Lxa72d8mFrzHqzqU,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQACAAE/Standing%20With%20Resilience%20Public.git.R1/0',
                                  'freenet://USK@AKL0griFs7T25yw6-JR3Wk7vocvNBelOLg3RwtIL6aTp,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQECAAE/Standing%20With%20Resilience%20Public.git.R1/0'),
    #### private freenet ####
    resilient.freenet.gitocalypse('freenet://USK@PSY0YngeDtGbj60hjEoilQiY9oKzVrptRC0rG4BEVPg,e6ZEjT4KvbsltPBJOeKNpIdty2oGzbLCdk4fsDA5Vdk,AQACAAE/Standing%20With%20Resilience.git.R1/0')
  ])


####################### Download from all

print(":: Pulling from git repos ...")

for repo in git_repos:
  repo.pull()

########################### Upload to all

print(":: Pushing to git repos ...")

for repo in git_repos:
  repo.push()


############################## Build wiki

if not resilient.ikiwiki.found:
  print (":: Not building wiki; missing ikiwiki")
  exit(0)

print (":: Building wiki ...")

if not resilient.ikiwiki().push():
  print (":: Exiting due to failure")
  exit(-1)

########################### Upload to all

print (":: Publishing site ...")

for host in hosts:
  host.push()

#########################################

print "Done."