blob: b62bd23ff515bce471f9772a911dabb2f844bca4 (
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
|
import os
import platform
import time
import threading
import ConfigParser
from leap.bitmask.app import main as leap_client
from leap.common.events import server
from thandy.ClientCLI import update as thandy_update
bundles_per_platform = {
"Windows" : "/bundleinfo/LEAPClient-win/",
"Darwin" : "",
"Linux" : "/bundleinfo/LEAPClient/",
}
GENERAL_SECTION = "General"
UPDATES_KEY = "Updates"
class Thandy(threading.Thread):
def run(self):
while True:
try:
os.environ["THANDY_HOME"] = os.path.join(os.getcwd(),
"config",
"thandy")
os.environ["THP_DB_ROOT"] = os.path.join(os.getcwd(),
"packages")
os.environ["THP_INSTALL_ROOT"] = os.path.join(os.getcwd(),
"updates")
args = [
"--repo=repo/",
"--install",
bundles_per_platform[platform.system()]
]
thandy_update(args)
except Exception as e:
print "ERROR:", e
finally:
# TODO: Make this delay configurable
time.sleep(60)
if __name__ == "__main__":
server.ensure_server(port=8090)
config = ConfigParser.ConfigParser()
config.read("launcher.conf")
launch_thandy = False
try:
launch_thandy = config.getboolean(GENERAL_SECTION, UPDATES_KEY)
except ConfigParser.NoSectionError as ns:
pass
except ConfigParser.NoOptionError as no:
pass
if launch_thandy:
thandy_thread = Thandy()
thandy_thread.daemon = True
thandy_thread.start()
leap_client()
|