From 13705c9e94dfa1d6c34f9895dc0a8b1ff97957f5 Mon Sep 17 00:00:00 2001 From: Karl Semich <0xloem@gmail.com> Date: Sun, 4 Sep 2016 08:51:51 -0400 Subject: launch zeronet if not running and ZERONETDIR provided --- backend/resilient/__init__.py | 13 +++++++++---- backend/update.py | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/backend/resilient/__init__.py b/backend/resilient/__init__.py index c42b5d1..ba994a6 100644 --- a/backend/resilient/__init__.py +++ b/backend/resilient/__init__.py @@ -126,10 +126,6 @@ class ikiwiki: class zeronet: - running = url200('http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D') - if not running: - print("WARNING: ZeroNet not running, won't be used") - found = 'ZERONETDIR' in os.environ if found: zn_datadir = os.path.join(os.environ['ZERONETDIR'], 'ZeroNet/data') @@ -138,6 +134,15 @@ class zeronet: if not found: print("WARNING: ZeroNet bundle not found in ZERONETDIR, public zeronet site won't be updated") + running = url200('http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D') + if found and not running: + proc = subprocess.Popen([zn_script]) + while not running and proc.returncode == None: + time.sleep(0.5) + running = url200('http://127.0.0.1:43110/1HeLLo4uzjaLetFx6NH3PMwFP3qbRbTf3D') + if not running: + print("WARNING: ZeroNet not running, won't be used") + def __init__(self, addr, key): self.addr = addr self.key = key diff --git a/backend/update.py b/backend/update.py index f97d0aa..50c3983 100755 --- a/backend/update.py +++ b/backend/update.py @@ -29,7 +29,7 @@ if resilient.freenet.freesitemgr.found and resilient.freenet.running: 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') + resilient.git('https://gitlab.com/standingwithresilience/standingwithresilience.gitlab.io.git', None) ] for host in zeronet_urls: -- cgit v1.2.3