Mercurial > sat_docs
annotate docker/libervia/scripts/libervia_cont_launch @ 142:2602c690806b
flatpak (sat_wrapper): don't use packages from $HOME in PYTHONPATH to avoid conflicts:
before this change, packages from ~/.local/lib/python2.7/site-packages when included, and
this could conflict with the ones from Flatpak, resulting in unwanted side effects (e.g.
OMEMO not available).
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 23 Jun 2019 19:45:37 +0200 |
parents | 5d8b9ca2afd4 |
children |
rev | line source |
---|---|
105 | 1 #!/usr/bin/env python2 |
2 | |
3 # this script check if libervia and admin accounts exist, and create them if necessary | |
4 # then it launch libervia | |
5 import os, sys, string, random | |
6 from sat.plugins import plugin_misc_account as account | |
7 from sat.tools import config | |
8 from sat_frontends.bridge import DBus | |
9 | |
10 def generate_pwd(): | |
11 chars = string.letters + string.digits | |
12 length = 12 | |
13 return "".join(random.choice(chars) for _ in range(length)) | |
14 | |
15 sat=DBus.DBusBridgeFrontend() | |
16 sat.getReady() | |
17 admin_email = sat.getConfig(account.CONFIG_SECTION, "admin_email") or account.default_conf["admin_email"] | |
18 | |
19 for profile in ["libervia", "admin"]: | |
20 try: | |
21 sat.getProfileName(profile) | |
22 except Exception as e: | |
115
5d8b9ca2afd4
docker (libervia): fixed bad escaping after moving libervia_cont_launch from Dockerfile to scripts/
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
23 print "{} profile doesn't exists, creating it".format(profile) |
105 | 24 print "registering {}@{}".format(profile, sat.getNewAccountDomain()) |
25 pwd = generate_pwd() | |
26 if profile == "libervia": | |
27 config.fixConfigOption("libervia", "passphrase", pwd) | |
28 elif profile == "admin": | |
29 with open("/home/sat/ADMIN_PWD", "w") as f: | |
115
5d8b9ca2afd4
docker (libervia): fixed bad escaping after moving libervia_cont_launch from Dockerfile to scripts/
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
30 f.write("%s\n" % pwd) |
105 | 31 sat.registerSatAccount(admin_email, pwd, profile) |
32 | |
33 os.execvp("libervia", ["libervia"] + sys.argv[1:]) |