just install now builds as you, then asks for root once and installs the whole thing: the login session (wasm compositor on the MoonBit host, modules, chandra-ctl, KDE colors, portal) and face unlock (helper, PAM module, config, models). The alternatives are flags instead of recipes: --link (was install-dev), --rust (install-rust), --native (install-native), --pam (install-face --pam), --no-face, --no-models. The PAM module is compiled as you into build/, so root only copies it; without a compiler or libpam headers face unlock is skipped with a warning. just uninstall removes face unlock too (--purge: enrolled faces). Removed: install-dev, install-rust, install-native, install-face, uninstall-face and the old install-session* / uninstall-session aliases. New docs/install.md; README, docs and installer hints updated. Also drops a committed __pycache__ file and ignores __pycache__/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hkA52AocBmJHipFRqb
This commit is contained in:
16 files changed
+171
-108
No files matched your search
+36
-14
@@ -1,19 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Install (or remove) the Chandra login session. Run as root, once (`just install` etc. do
|
||||
this through scripts/as-root, which uses run0 and falls back to sudo, doas or pkexec):
|
||||
"""Install (or remove) Chandra: the login session and face unlock. `just install` is the way in:
|
||||
it builds everything as you, then runs this as root once (through scripts/as-root, which uses
|
||||
run0 and falls back to sudo, doas or pkexec). Running it is idempotent: it replaces what is there.
|
||||
|
||||
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)
|
||||
run0 python3 session/install.py --native # install the native compositor instead
|
||||
run0 python3 session/install.py --rust-host # the wasm compositor on the Rust host (host-wasm)
|
||||
run0 python3 session/install.py --remove # uninstall
|
||||
just install # the compositor as a wasm component on the MoonBit host
|
||||
just install --link # dev: symlink into this checkout (see below)
|
||||
just install --rust # the wasm compositor on the Rust host (host-wasm)
|
||||
just install --native # the native compositor instead
|
||||
just install --pam # also turn face unlock on for polkit-1 and sudo
|
||||
just install --no-face # leave face unlock out
|
||||
just uninstall [--purge] # remove it all (--purge: the enrolled faces too)
|
||||
|
||||
(`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.)
|
||||
By hand, from the checkout's root, after building: `run0 python3 session/install.py [FLAGS]`
|
||||
(`sudo` works the same; run0 keeps the working directory when the target is 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.
|
||||
Face unlock is copied either way (PAM loads it as root: it must not point into a user's checkout).
|
||||
|
||||
Installs:
|
||||
/usr/local/bin/chandra-host host that runs the compositor component (build/wasmhost)
|
||||
@@ -33,6 +37,7 @@ Installs:
|
||||
/usr/share/xsessions/chandra-x11.desktop display-manager entry on Xorg (NVIDIA; docs/x11.md)
|
||||
/usr/share/xdg-desktop-portal/portals/chandra.portal xdg-desktop-portal backend: the compositor
|
||||
/usr/share/xdg-desktop-portal/chandra-portals.conf serves Settings (apps' dark/light preference)
|
||||
face unlock face/install.py (chandra-face, pam_chandra_face.so, models)
|
||||
"""
|
||||
import os, shutil, subprocess, sys
|
||||
|
||||
@@ -40,9 +45,9 @@ root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
native = "--native" in sys.argv
|
||||
linked = "--link" in sys.argv
|
||||
exe = os.path.join(root, "_build/native/release/build/compositor/bin/bin.exe")
|
||||
rust_host = "--rust-host" in sys.argv
|
||||
rust_host = "--rust" in sys.argv or "--rust-host" in sys.argv
|
||||
# The host that runs the compositor component: the MoonBit one (just wasmhost), or the Rust
|
||||
# one (just host-wasm) with --rust-host. Either is installed as chandra-host.
|
||||
# one (just host-wasm) with --rust. Either is installed as chandra-host.
|
||||
host_build = "just host-wasm" if rust_host else "just wasmhost"
|
||||
host = os.path.join(root, "host-wasm/target/release/chandra-host" if rust_host else "build/wasmhost")
|
||||
component = os.path.join(root, "build/compositor.wasm")
|
||||
@@ -65,7 +70,21 @@ targets = [
|
||||
if os.geteuid() != 0:
|
||||
sys.exit("run as root: run0 python3 session/install.py (or sudo), or `just install`")
|
||||
|
||||
face_flags = [f for f in sys.argv[1:] if f in ("--pam", "--no-models", "--purge")]
|
||||
if "--pixi" in sys.argv and sys.argv.index("--pixi") + 1 < len(sys.argv):
|
||||
face_flags += ["--pixi", sys.argv[sys.argv.index("--pixi") + 1]]
|
||||
|
||||
def face(*flags):
|
||||
"""Face unlock has its own installer (face/install.py); run it as part of this one. Its failure
|
||||
(no network for the models, say) doesn't undo the session: say so, and fail at the end."""
|
||||
rc = subprocess.call([sys.executable, os.path.join(root, "face/install.py")] + list(flags) + face_flags)
|
||||
if rc != 0:
|
||||
print("warning: face unlock: face/install.py %s failed (exit %d)" % (" ".join(flags + tuple(face_flags)), rc),
|
||||
file=sys.stderr)
|
||||
return rc
|
||||
|
||||
if "--remove" in sys.argv:
|
||||
face_rc = face("--remove")
|
||||
for t in targets:
|
||||
if os.path.lexists(t):
|
||||
os.remove(t)
|
||||
@@ -76,7 +95,7 @@ if "--remove" in sys.argv:
|
||||
if os.path.isdir(share) and not os.path.islink(share):
|
||||
shutil.rmtree(share) # removes symlinks, never what they point at
|
||||
print("removed", share)
|
||||
sys.exit(0)
|
||||
sys.exit(1 if face_rc else 0)
|
||||
|
||||
if native:
|
||||
if not os.path.exists(exe):
|
||||
@@ -169,9 +188,10 @@ mods = os.path.join(root, "build/components")
|
||||
dst = os.path.join(share, "modules")
|
||||
if linked:
|
||||
link(mods, dst)
|
||||
face_rc = face() if "--no-face" not in sys.argv else 0
|
||||
print("done: pick 'Chandra' in the session menu; rebuild with `just compositor-wasm %s modules`" % host_build.split()[1])
|
||||
print("(in a running session, `just modules reload` picks up rebuilt panel modules)")
|
||||
sys.exit(0)
|
||||
print("(in a running session, `just reload` picks up rebuilt panel modules)")
|
||||
sys.exit(1 if face_rc else 0)
|
||||
if os.path.lexists(dst):
|
||||
shutil.rmtree(dst) if os.path.isdir(dst) and not os.path.islink(dst) else os.remove(dst)
|
||||
os.makedirs(dst, exist_ok=True)
|
||||
@@ -183,6 +203,8 @@ for f in sorted(os.listdir(mods)) if os.path.isdir(mods) else []:
|
||||
if n == 0:
|
||||
sys.exit("no modules in build/components - run `just modules` first")
|
||||
print("installed", n, "modules in", dst)
|
||||
face_rc = face() if "--no-face" not in sys.argv else 0
|
||||
print("done: pick 'Chandra' in the session menu of your login screen")
|
||||
print("already in a Chandra session? `just reload` (chandra-ctl reload) picks up the new panel modules;")
|
||||
print("the compositor and host themselves need a new session (docs/reloading.md)")
|
||||
sys.exit(1 if face_rc else 0)
|
||||
Reference in new issue
Block a user