summaryrefslogtreecommitdiff
path: root/backend/resilient/freenet.py
blob: 76ee33d8ab303e1aa8fd5343d6fb920f0c732026 (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
from resilient import auth_path, dep_path, git, ikiwiki, url200
import os

running = url200('http://127.0.0.1:8888/')
if not running:
  print("WARNING: freenet not running, changes won't be synced with freenet")

class gitocalypse(git):
  found = (os.system("git-remote-freenet") == 256)
  if not found:
    print("WARNING: gitocalypse not found, changes won't be synced with freenet")

class freesitemgr():
  binary = "freesitemgr"
  found = (os.system("%s --version" % binary) == 0)
  if not found:
    binary = "%s/pyFreenet/freesitemgr" % dep_path
    found = (os.system("%s --version" % binary) == 0)
  if not found:
    print("WARNING: freesitemgr/pyFreenet not found. freesite won't be updated")

  def __init__(self):
    pass

  def push(self):
    if not ikiwiki.synced or not freesitemgr.found or not running:
      return False
    config_path = os.path.join(auth_path, 'freesitemgr')
    status = os.system("%s -c '%s' -v -r 1 update" % (freesitemgr.binary, config_path))
    return status == 0