Skip to content

Commit

Permalink
Merge pull request #80 from TheTorProject/feature/ooniprobe-v2
Browse files Browse the repository at this point in the history
Fix WUI port number, sync lepidopter-update, add version/source code URL
  • Loading branch information
anadahz authored Sep 15, 2016
2 parents dbc5147 + a99f4b7 commit e692190
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lepidopter-fh/etc/avahi/services/ooniprobe.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<name replace-wildcards="yes">ooniprobe GUI on %h</name>
<service>
<type>_http._tcp</type>
<port>89</port>
<port>80</port>
</service>
</service-group>
32 changes: 31 additions & 1 deletion lepidopter-fh/opt/ooni/lepidopter-update/updater.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,43 @@
#!/usr/bin/env python2
# Version: 16b10e7e4afb32fd7430cd7a8d01cd371f29e399
# Source code: https://github.com/OpenObservatory/lepidopter-update
"""
This is the auto-updater script for lepidopter.
It must be run from root and it takes care of downloading the most recent
updates and doing all the operations needed to perform the update.
To run it expects systemd to be configured.
This script includes a self-installer which can be run via:
python updater.py install
It then expects to be run as a systemd service with:
python updater.py update --watch
"""

from __future__ import print_function

import os
import re
import imp # XPY3 this is deprecated in python3
import sys
import time
import errno
import shutil
import getpass
import logging
import tempfile
import argparse

from subprocess import check_output, check_call, CalledProcessError

# The version number of the updater
__version__ = "1.0.0"

LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"
# UPDATE_BASE_URL/latest/version must return an integer containing the latest version number
# UPDATE_BASE_URL/VERSION/update.py must return the update script for VERSION
# UPDATE_BASE_URL/VERSION/update.py.asc must return a valid GPG signature for update.py
Expand Down Expand Up @@ -326,7 +350,12 @@ def _setup_logging(args):
except AttributeError:
raise InvalidLogLevel()

logging.basicConfig(filename=log_file, level=log_level)
logging.basicConfig(filename=log_file, level=log_level, format=LOG_FORMAT)

def _check_user():
if getpass.getuser() != 'root':
print("ERROR: this script must be run as root!")
sys.exit(1)

def main():
parser = argparse.ArgumentParser(description="Auto-update system for lepidopter")
Expand All @@ -350,6 +379,7 @@ def main():

args = parser.parse_args()
_setup_logging(args)
_check_user()
args.func(args)


Expand Down

0 comments on commit e692190

Please sign in to comment.