]> glassweightruler.freedombox.rocks Git - waydroid.git/blob - tools/config/__init__.py
tools: Remove umask 0
[waydroid.git] / tools / config / __init__.py
1 # Copyright 2021 Oliver Smith
2 # SPDX-License-Identifier: GPL-3.0-or-later
3 import os
4 import pwd
5
6 #
7 # Exported functions
8 #
9 from tools.config.load import load, load_channels
10 from tools.config.save import save
11
12 #
13 # Exported variables (internal configuration)
14 #
15 version = "1.3.4"
16 tools_src = os.path.normpath(os.path.realpath(__file__) + "/../../..")
17
18 # Keys saved in the config file (mostly what we ask in 'waydroid init')
19 config_keys = ["arch",
20 "images_path",
21 "vendor_type",
22 "system_datetime",
23 "vendor_datetime",
24 "suspend_action"]
25
26 # Config file/commandline default values
27 # $WORK gets replaced with the actual value for args.work (which may be
28 # overridden on the commandline)
29 defaults = {
30 "arch": "arm64",
31 "work": "/var/lib/waydroid",
32 "vendor_type": "MAINLINE",
33 "system_datetime": "0",
34 "vendor_datetime": "0",
35 "preinstalled_images_paths": [
36 "/etc/waydroid-extra/images",
37 "/usr/share/waydroid-extra/images",
38 ],
39 "suspend_action": "freeze"
40 }
41 defaults["images_path"] = defaults["work"] + "/images"
42 defaults["rootfs"] = defaults["work"] + "/rootfs"
43 defaults["data"] = defaults["work"] + "/data"
44 defaults["lxc"] = defaults["work"] + "/lxc"
45 defaults["host_perms"] = defaults["work"] + "/host-permissions"
46
47 session_defaults = {
48 "user_name": pwd.getpwuid(os.getuid()).pw_name,
49 "user_id": str(os.getuid()),
50 "group_id": str(os.getgid()),
51 "host_user": os.path.expanduser("~"),
52 "pid": str(os.getpid()),
53 "xdg_data_home": str(os.environ.get('XDG_DATA_HOME', os.path.expanduser("~") + "/.local/share")),
54 "xdg_runtime_dir": str(os.environ.get('XDG_RUNTIME_DIR')),
55 "wayland_display": str(os.environ.get('WAYLAND_DISPLAY')),
56 "pulse_runtime_path": str(os.environ.get('PULSE_RUNTIME_PATH')),
57 "state": "STOPPED",
58 "lcd_density": "0"
59 }
60 session_defaults["config_path"] = defaults["work"] + "/session.cfg"
61 session_defaults["waydroid_data"] = session_defaults["xdg_data_home"] + \
62 "/waydroid/data"
63 if session_defaults["pulse_runtime_path"] == "None":
64 session_defaults["pulse_runtime_path"] = session_defaults["xdg_runtime_dir"] + "/pulse"
65
66 channels_defaults = {
67 "config_path": "/usr/share/waydroid-extra/channels.cfg",
68 "system_channel": "https://ota.waydro.id/system",
69 "vendor_channel": "https://ota.waydro.id/vendor",
70 "rom_type": "lineage",
71 "system_type": "VANILLA"
72 }
73 channels_config_keys = ["system_channel",
74 "vendor_channel",
75 "rom_type",
76 "system_type"]