diff options
Diffstat (limited to 'backend/update.py')
-rwxr-xr-x | backend/update.py | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/backend/update.py b/backend/update.py index f605b39..0c10e66 100755 --- a/backend/update.py +++ b/backend/update.py @@ -2,24 +2,78 @@ import os +found_git = (os.system("git status --porcelain") == 0) + +if not found_git: + print("ERROR: git not found") + exit(1) + +found_ikiwiki = (os.system("ikiwiki --version") == 0) +found_gitocalypse = (os.system("git-remote-freenet") == 256) +found_freesitemgr = (os.system("freesitemgr --version") == 0) + +if not found_ikiwiki: + print("WARNING: ikiwiki not found, pages will not be built") +if not found_gitocalypse: + print("WARNING: gitocalypse not found, changes won't be synced with freenet") +if not found_freesitemgr: + print("WARNING: freesitemgr/pyFreenet not found, public freesite won't be updated") + +if not (found_ikiwiki or found_gitocalypse or found_freesitemgr): + print("Changes will still be propagated if branchable is working.") + +print(":: Pulling from simple repos ...") + status = 0 status += os.system("git pull git://standingwithresilience.branchable.com/") -#status += os.system("git pull fairlystable-guest:/srv/git/standingwithresilience") if status != 0: - exit(status) + print("WARNING: failed to pull changes from branchable") + #exit(status) + +#status += os.system("git pull fairlystable-guest:/srv/git/standingwithresilience") + + +# Pull from freenet repos +if found_gitocalypse: + print(":: Pulling from freenet repos ...") + # public freenet + os.system("git pull freenet://USK@hCLgfaINNSNAl4do-PapEincQP5Lxa72d8mFrzHqzqU,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQACAAE/Standing%20With%20Resilience%20Public.git.R1/0 master") + # private freenet + os.system("git pull freenet://USK@PSY0YngeDtGbj60hjEoilQiY9oKzVrptRC0rG4BEVPg,e6ZEjT4KvbsltPBJOeKNpIdty2oGzbLCdk4fsDA5Vdk,AQACAAE/Standing%20With%20Resilience.git.R1/0 master") + + +print(":: Pushing to simple repos ...") status += os.system("git push git://standingwithresilience.branchable.com/") -status += os.system("git gc --prune=0") + + +# Push to freenet repos +if found_gitocalypse: + print (":: Pushing to freenet repos ...") + # public freenet + os.system("git push freenet://USK@AKL0griFs7T25yw6-JR3Wk7vocvNBelOLg3RwtIL6aTp,jjuBPGO~oCByVoZ5f4Bny0Gp-l3kuDOtf3m-QBT4ekA,AQECAAE/Standing%20With%20Resilience%20Public.git.R1/0") + #private freenet + ##### + + +# Build wiki if status != 0: exit(status) +if not found_ikiwiki: + exit(0) + +print (":: Building wiki ...") + status += os.system("ikiwiki --rebuild ../wiki ../html") if status != 0: exit(status) -status += os.system("freesitemgr -c freesitemgr -v -l freesitemgr.log -r 0 update") +if found_freesitemgr: + print (":: Publishing freesite ...") + status += os.system("freesitemgr -c freesitemgr -v -l freesitemgr.log -r 0 update") print "Done." |