Mercurial > sat_docs
view 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 |
line wrap: on
line source
#!/usr/bin/env python2 # this script check if libervia and admin accounts exist, and create them if necessary # then it launch libervia import os, sys, string, random from sat.plugins import plugin_misc_account as account from sat.tools import config from sat_frontends.bridge import DBus def generate_pwd(): chars = string.letters + string.digits length = 12 return "".join(random.choice(chars) for _ in range(length)) sat=DBus.DBusBridgeFrontend() sat.getReady() admin_email = sat.getConfig(account.CONFIG_SECTION, "admin_email") or account.default_conf["admin_email"] for profile in ["libervia", "admin"]: try: sat.getProfileName(profile) except Exception as e: print "{} profile doesn't exists, creating it".format(profile) print "registering {}@{}".format(profile, sat.getNewAccountDomain()) pwd = generate_pwd() if profile == "libervia": config.fixConfigOption("libervia", "passphrase", pwd) elif profile == "admin": with open("/home/sat/ADMIN_PWD", "w") as f: f.write("%s\n" % pwd) sat.registerSatAccount(admin_email, pwd, profile) os.execvp("libervia", ["libervia"] + sys.argv[1:])