Mercurial > sat_docs
annotate docker/libervia/scripts/libervia_cont_launch @ 134:4549cf265131
flatpak: install D-Bus .service on each frontend:
work around lack of dependency handling in Flatpak by installing D-Bus .service on each frontend.
This works because all backend is included in the runtime, but we have to add backend permissions to all frontend, and set --own-name=org.salutatoi.SAT.
Furthermore, if one frontend is removed, the symbolic link is removed and the backend will not be launched automatically anymore, even if other frontends are still there.
The benefict of this method is that backend has not to be installed manually to use a frontend.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 15 Jul 2018 16:56:55 +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:]) |