Mercurial > sat_docs
annotate docker_legacy/libervia/scripts/libervia_cont_launch @ 168:b3c469e1f5f3
association: mise à jour AG 2020 + source:
le texte sur la demande de subvention de eevvoor a été corrigé à la demande de cette
dernière sur le salon SàT.
Le fichier source .odt a également été ajouté.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 02 Jan 2021 08:50:43 +0100 |
parents | 29873a41aae1 |
children |
rev | line source |
---|---|
164
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/env python2 |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 # this script check if libervia and admin accounts exist, and create them if necessary |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # then it launch libervia |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 import os, sys, string, random |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 from sat.plugins import plugin_misc_account as account |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 from sat.tools import config |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 from sat_frontends.bridge import DBus |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 def generate_pwd(): |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 chars = string.letters + string.digits |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 length = 12 |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 return "".join(random.choice(chars) for _ in range(length)) |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 sat=DBus.DBusBridgeFrontend() |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 sat.getReady() |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 admin_email = sat.getConfig(account.CONFIG_SECTION, "admin_email") or account.default_conf["admin_email"] |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 for profile in ["libervia", "admin"]: |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 try: |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 sat.getProfileName(profile) |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 except Exception as e: |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 print "{} profile doesn't exists, creating it".format(profile) |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 print "registering {}@{}".format(profile, sat.getNewAccountDomain()) |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 pwd = generate_pwd() |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 if profile == "libervia": |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 config.fixConfigOption("libervia", "passphrase", pwd) |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 elif profile == "admin": |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 with open("/home/sat/ADMIN_PWD", "w") as f: |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 f.write("%s\n" % pwd) |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 sat.registerSatAccount(admin_email, pwd, profile) |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 |
29873a41aae1
docker: new docker files are now in sat main repos, this one is legacy
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 os.execvp("libervia", ["libervia"] + sys.argv[1:]) |