run0: install via scripts/as-root, chandra-root for GUI apps as root, session refuses root
CI / test (push) Failing after 16s
CI / test (push) Failing after 16s
- scripts/as-root runs a command as root with run0 (systemd PID 1 + run0 present), else sudo, doas or pkexec; resolves the program to an absolute path since run0 doesn't inherit PATH. The install-session recipes use it and pass install.py by absolute path. - session/chandra-root (installed to /usr/local/bin): run a graphical app as root inside Chandra, passing WAYLAND_DISPLAY (absolute) and the Wayland toolkit variables through run0 --setenv (or sudo/doas/pkexec env). - chandra-session: refuses to run as root (CHANDRA_ALLOW_ROOT=1 overrides), fills in HOME and XDG_RUNTIME_DIR when started without a login environment, logs when the logind session has no seat (run0 --user / su / ssh), and starts an installed polkit agent once the socket is up so run0/pkexec from the launcher can prompt (CHANDRA_POLKIT_AGENT picks one or 'none'). - install.py: checks for root before --remove too; installs chandra-root. - docs/run0.md: invocations for installing, starting from a TTY, apps as root, polkit agents. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hkq6Hq7AXG85g5HyJU
This commit is contained in:
7 files changed
+254
-8
No files matched your search
+11
-3
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Install (or remove) the Chandra login session. Run as root, once:
|
||||
"""Install (or remove) the Chandra login session. Run as root, once (`just install-session` etc. do
|
||||
this through scripts/as-root, which uses run0 and falls back to sudo, doas or pkexec):
|
||||
|
||||
run0 python3 session/install.py # install: the compositor as a wasm component
|
||||
run0 python3 session/install.py --link # dev: symlink into this checkout (see below)
|
||||
@@ -7,6 +8,9 @@
|
||||
run0 python3 session/install.py --rust-host # the wasm compositor on the Rust host (host-wasm)
|
||||
run0 python3 session/install.py --remove # uninstall
|
||||
|
||||
(`sudo python3 session/install.py` works the same. run0 keeps the working directory when the
|
||||
target is root, so the relative path is fine from the checkout's root.)
|
||||
|
||||
With --link nothing is copied: the installed files are symlinks to the build outputs in this
|
||||
checkout, so after one root install, `just compositor-wasm wasmhost modules` is all it takes for the
|
||||
next login to run your latest build (no root, no reinstall). The checkout must stay where it is.
|
||||
@@ -16,6 +20,7 @@ Installs:
|
||||
/usr/local/share/chandra/compositor.wasm the compositor, as a WebAssembly component
|
||||
/usr/local/bin/chandra (--native) release native compositor binary
|
||||
/usr/local/bin/chandra-session session launcher (starts the host if installed)
|
||||
/usr/local/bin/chandra-root run one graphical app as root in the session (run0)
|
||||
/usr/local/share/chandra/{config,wit,assets}/ files the compositor reads at runtime
|
||||
/usr/local/share/chandra/modules/*.wasm the panel's wasm modules (build them first: just modules)
|
||||
/usr/share/wayland-sessions/chandra.desktop display-manager entry
|
||||
@@ -37,9 +42,13 @@ targets = [
|
||||
"/usr/local/bin/chandra",
|
||||
"/usr/local/bin/chandra-host",
|
||||
"/usr/local/bin/chandra-session",
|
||||
"/usr/local/bin/chandra-root",
|
||||
"/usr/share/wayland-sessions/chandra.desktop",
|
||||
]
|
||||
|
||||
if os.geteuid() != 0:
|
||||
sys.exit("run as root: run0 python3 session/install.py (or sudo), or `just install-session`")
|
||||
|
||||
if "--remove" in sys.argv:
|
||||
for t in targets:
|
||||
if os.path.lexists(t):
|
||||
@@ -50,8 +59,6 @@ if "--remove" in sys.argv:
|
||||
print("removed", share)
|
||||
sys.exit(0)
|
||||
|
||||
if os.geteuid() != 0:
|
||||
sys.exit("run as root: run0 python3 session/install.py")
|
||||
if native:
|
||||
if not os.path.exists(exe):
|
||||
sys.exit("missing %s - run `just build-release` first" % exe)
|
||||
@@ -94,6 +101,7 @@ os.makedirs(share, exist_ok=True)
|
||||
if not native:
|
||||
install(component, os.path.join(share, "compositor.wasm"))
|
||||
install(os.path.join(root, "session/chandra-session"), "/usr/local/bin/chandra-session")
|
||||
install(os.path.join(root, "session/chandra-root"), "/usr/local/bin/chandra-root")
|
||||
# The display-manager entry stays a real file: some managers don't follow symlinks there.
|
||||
put(os.path.join(root, "session/chandra.desktop"), "/usr/share/wayland-sessions/chandra.desktop", 0o644)
|
||||
# Read at runtime relative to the working directory (the launcher cd's here): the Interface Explorer
|
||||
|
||||
Reference in new issue
Block a user