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
+166
-103
No files matched your search
@@ -13,3 +13,4 @@ host-wasm/target/
|
||||
# (app, gfx, renderer, scene) were committed early and stay tracked; the rest are not.
|
||||
compositor/*/pkg.generated.mbti
|
||||
wasmhost/*/pkg.generated.mbti
|
||||
__pycache__/
|
||||
@@ -77,11 +77,11 @@ just client # start foot inside it (or: just client konsol
|
||||
| `just run` | Nested in a window on your Wayland session, MoonBit host |
|
||||
| `just run-drm` | As a login session on the real screen (from a text console, as yourself) |
|
||||
| `just run-x11` | On the X server in `$DISPLAY` (NVIDIA on Xorg; the whole screen when no window manager runs) |
|
||||
| `just install` | Install the "Chandra" display-manager session, and "Chandra (X11)" for Xorg (asks for root once) |
|
||||
| `just install-dev` | Same, but symlinked into this checkout: later just rebuild |
|
||||
| `just install` | Install everything: the "Chandra" display-manager session, "Chandra (X11)" for Xorg, and face unlock (asks for root once). `--link` symlinks into this checkout (later just rebuild), `--rust` / `--native` pick the Rust host / native compositor, `--pam` turns face unlock on, `--no-face` skips it |
|
||||
| `just uninstall` | Remove it all again (`--purge` also deletes enrolled faces) |
|
||||
| `just reload` | Reload the running session's panel modules from disk (`chandra-ctl reload [NAME]`) |
|
||||
| `just run-rust`, `run-drm-rust`, `install-rust` | The same with the Rust host |
|
||||
| `just run-native`, `run-drm-native`, `install-native` | The native (non-wasm) build |
|
||||
| `just run-rust`, `run-drm-rust` | The same with the Rust host |
|
||||
| `just run-native`, `run-drm-native` | The native (non-wasm) build |
|
||||
| `just compositor-wasm`, `wasmhost`, `host-wasm`, `modules` | Build one piece |
|
||||
| `just test` | Native compositor tests and lib tests |
|
||||
| `just frame` | Render one composed frame to `_build/e2e_frame.png` |
|
||||
@@ -98,11 +98,11 @@ sizes, for an app that draws at the wrong size.
|
||||
The installed session logs to `~/.local/state/chandra/session.log`. Start it as yourself, never
|
||||
as root: `chandra-session` refuses to run as root (`CHANDRA_ALLOW_ROOT=1` overrides). Installing
|
||||
goes through `scripts/as-root`, which prefers run0 and falls back to sudo, doas or pkexec
|
||||
(`CHANDRA_AS_ROOT` picks one). To run a graphical app as root inside Chandra, use
|
||||
(`CHANDRA_AS_ROOT` picks one). What it installs and its flags: [docs/install.md](docs/install.md). To run a graphical app as root inside Chandra, use
|
||||
`chandra-root gparted`. Details, including polkit agents (`CHANDRA_POLKIT_AGENT`), are in
|
||||
[docs/run0.md](docs/run0.md).
|
||||
|
||||
Face unlock, in the style of Howdy: `just install-face`, then Settings > Session > Face unlock to
|
||||
Face unlock, in the style of Howdy, comes with `just install`: then Settings > Session > Face unlock to
|
||||
add a face and use it for the password dialog and sudo (a PAM module; the password always still
|
||||
works). See [docs/face-unlock.md](docs/face-unlock.md), including what 2D face recognition can't
|
||||
protect against.
|
||||
|
||||
@@ -104,11 +104,11 @@ test "Settings > Session: face unlock lists faces, adds one, turns it on, remove
|
||||
test "face unlock status lines" {
|
||||
let f = @shell.FaceUnlock::new()
|
||||
f.apply_status([
|
||||
"backend opencv", "device /dev/video0", "problem OpenCV is missing: run just install-face", "pam polkit-1,sudo",
|
||||
"backend opencv", "device /dev/video0", "problem OpenCV is missing: run just install", "pam polkit-1,sudo",
|
||||
"howdy login,gdm-password", "face 3\tGlasses\t2026-11-01",
|
||||
])
|
||||
assert_true(f.installed)
|
||||
assert_eq(f.problem, "OpenCV is missing: run just install-face")
|
||||
assert_eq(f.problem, "OpenCV is missing: run just install")
|
||||
assert_true(f.in_use())
|
||||
assert_eq(f.howdy, "login, gdm-password")
|
||||
assert_eq(f.faces, [("3", "Glasses", "2026-11-01")])
|
||||
|
||||
+10
-6
@@ -11,20 +11,24 @@ any other service you add it to.
|
||||
## Setting it up
|
||||
|
||||
```sh
|
||||
just install-face # PAM module, chandra-face, settings, face models (asks for root once)
|
||||
just install # comes with the rest of Chandra (asks for root once)
|
||||
just install --pam # ... and turns it on for polkit-1 and sudo right away
|
||||
```
|
||||
|
||||
`just install` installs the PAM module, `chandra-face`, its settings and the face models along
|
||||
with the session; `--no-face` leaves them out. Without a C compiler or the PAM headers it warns
|
||||
and installs everything else.
|
||||
|
||||
Nothing from the distro is needed beyond a C compiler and the PAM headers (`libpam0g-dev` /
|
||||
`pam-devel`) and [pixi](https://pixi.sh): Python, OpenCV and numpy come from a pixi environment
|
||||
(`face/pixi.toml` + `face/pixi.lock`) that install-face makes in `/usr/local/lib/chandra/face-env`,
|
||||
(`face/pixi.toml` + `face/pixi.lock`) that `just install` makes in `/usr/local/lib/chandra/face-env`,
|
||||
owned by root. It is deliberately not the checkout's `.pixi`: the PAM module runs that Python as
|
||||
root, so it must not be anywhere a user can write. The models (OpenCV's YuNet face detector and
|
||||
SFace recognizer, 37 MB) are downloaded from the opencv_zoo repository and checked against their
|
||||
SHA-256 sums. The environment takes about 450 MB.
|
||||
|
||||
The Settings rows are part of the session, not of `install-face`: after updating Chandra, run
|
||||
`just install` (or `just install-dev`) and log in again so the compositor, its host and the
|
||||
Settings module are the new ones. (`just reload` alone isn't enough: an older host doesn't serve
|
||||
The Settings rows are part of the session: after `just install`, log in again so the
|
||||
compositor, its host and the Settings module are the new ones. (`just reload` alone isn't enough: an older host doesn't serve
|
||||
the `face-unlock` capability.) Then in **Settings > Session > Face unlock**:
|
||||
|
||||
- **Add a face…** asks for your password (in the password dialog), then looks through the
|
||||
@@ -46,7 +50,7 @@ chandra-face clear # forget every face
|
||||
chandra-face pam enable polkit-1 sudo
|
||||
chandra-face pam disable # polkit-1 and sudo by default
|
||||
chandra-face status # what is set up, what is missing
|
||||
just uninstall-face # takes it out of every PAM service first
|
||||
just uninstall [--purge] # takes it out of every PAM service first (--purge: faces too)
|
||||
```
|
||||
|
||||
## In the password dialog
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# Installing
|
||||
|
||||
One recipe installs everything:
|
||||
|
||||
```sh
|
||||
just install
|
||||
```
|
||||
|
||||
It builds as you first (the compositor as a wasm component, the MoonBit host, the panel modules
|
||||
and face unlock's PAM module), then asks for root once, through `scripts/as-root` (run0, else
|
||||
sudo, doas or pkexec; see [run0.md](run0.md)), and installs:
|
||||
|
||||
- the "Chandra" login session: `chandra-host`, `compositor.wasm`, `chandra-session`,
|
||||
`chandra-root`, `chandra-ctl` and the display-manager entries ("Chandra", and "Chandra (X11)"
|
||||
for Xorg, see [x11.md](x11.md));
|
||||
- the panel modules, the theme, fonts and wit files under `/usr/local/share/chandra`;
|
||||
- dark mode for apps: the xdg-desktop-portal backend ([dark-mode.md](dark-mode.md)) and
|
||||
`chandra-kde-colors` with its KDE color schemes;
|
||||
- face unlock: `chandra-face`, `pam_chandra_face.so`, `/etc/chandra/face.conf` and the face
|
||||
models ([face-unlock.md](face-unlock.md)). PAM services are only changed with `--pam`.
|
||||
|
||||
Running it again replaces what is there, so it is also how you update. Log in again afterwards
|
||||
for a new compositor or host; `just reload` picks up new panel modules in a running session
|
||||
([reloading.md](reloading.md)).
|
||||
|
||||
| Flag | What it changes |
|
||||
|---|---|
|
||||
| `--link` | Symlink the session into this checkout instead of copying: after that, rebuilding (`just compositor-wasm wasmhost modules`) is all the next login needs, no root. The checkout must stay where it is. Face unlock is copied either way. |
|
||||
| `--rust` | Use the Rust host (`host-wasm`, about 2 minutes to build cold) instead of the MoonBit one |
|
||||
| `--native` | Install the native compositor (system-cc release build) instead of the wasm one |
|
||||
| `--pam` | Also turn face unlock on for `polkit-1` and `sudo` (Settings > Session can do it later) |
|
||||
| `--no-face` | Leave face unlock out |
|
||||
| `--no-models` | Don't download the face models now |
|
||||
|
||||
Flags combine: `just install --link --pam`. Without a C compiler or the PAM headers
|
||||
(`libpam0g-dev` / `pam-devel`) face unlock is skipped with a warning and everything else is
|
||||
installed.
|
||||
|
||||
To remove it all: `just uninstall` (face unlock is taken out of every PAM service first).
|
||||
`just uninstall --purge` also deletes the enrolled faces and `/etc/chandra/face.conf`.
|
||||
+1
-1
@@ -19,7 +19,7 @@ that: without the handler the signal's default action ends the session.
|
||||
## Reloading panel modules
|
||||
|
||||
```
|
||||
just install # or: just modules, with install-dev
|
||||
just install # or: just modules, after `just install --link`
|
||||
just reload # reload every panel module from disk
|
||||
just reload clock-digital # just one
|
||||
```
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ Everything below works with sudo, doas or pkexec too; run0 is only preferred whe
|
||||
## Installing the login session
|
||||
|
||||
```bash
|
||||
just install # or install-dev / install-native / uninstall
|
||||
just install # flags: --link, --rust, --native, --pam, --no-face; and `just uninstall`
|
||||
```
|
||||
|
||||
These go through `scripts/as-root`, which uses run0 if systemd is PID 1 and run0 is installed,
|
||||
|
||||
+2
-2
@@ -248,7 +248,7 @@ class OpenCVRecognizer:
|
||||
import cv2 # noqa
|
||||
import numpy # noqa
|
||||
except ImportError:
|
||||
raise Fail("OpenCV is missing: run just install-face", 2)
|
||||
raise Fail("OpenCV is missing: run just install", 2)
|
||||
import cv2
|
||||
import numpy as np
|
||||
|
||||
@@ -622,7 +622,7 @@ def cmd_status(cfg, user, out):
|
||||
try:
|
||||
import cv2 # noqa
|
||||
except ImportError:
|
||||
problem = "OpenCV is missing: run just install-face"
|
||||
problem = "OpenCV is missing: run just install"
|
||||
if not problem:
|
||||
for m in MODELS:
|
||||
if not os.path.exists(os.path.join(cfg.models, m)):
|
||||
|
||||
+24
-13
@@ -1,11 +1,12 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Install (or remove) face unlock. Run as root (`just install-face` does this through
|
||||
scripts/as-root):
|
||||
"""Install (or remove) face unlock. `just install` runs this (through session/install.py, as
|
||||
root) along with the rest of Chandra; `just install --pam` adds --pam, `just uninstall` --remove.
|
||||
By hand, as root:
|
||||
|
||||
run0 python3 face/install.py # install, fetch the face models
|
||||
run0 python3 face/install.py --pam # ... and use it for polkit-1 and sudo
|
||||
run0 python3 face/install.py --no-models
|
||||
run0 python3 face/install.py --pixi PATH # the pixi binary (`just install-face` passes it)
|
||||
run0 python3 face/install.py --pixi PATH # the pixi binary (`just install` passes it)
|
||||
run0 python3 face/install.py --remove # take it out of every PAM service, uninstall
|
||||
run0 python3 face/install.py --remove --purge # ... and delete the enrolled faces
|
||||
|
||||
@@ -14,7 +15,8 @@ Installs:
|
||||
face/pixi.toml + pixi.lock (root's; nothing from the distro)
|
||||
/usr/local/lib/chandra/chandra-face the helper (enroll, compare, ...), root's
|
||||
/usr/local/bin/chandra-face -> the helper
|
||||
<PAM module dir>/pam_chandra_face.so the PAM module (built here with cc; needs libpam headers)
|
||||
<PAM module dir>/pam_chandra_face.so the PAM module (`just install` builds it as you into
|
||||
build/; else it's built here with cc and the libpam headers)
|
||||
/etc/chandra/face.conf settings (kept when it exists)
|
||||
/var/lib/chandra-face/ enrolled faces
|
||||
/usr/local/share/chandra/face/*.onnx the YuNet and SFace models (downloaded, checksummed)
|
||||
@@ -61,7 +63,7 @@ def make_env():
|
||||
pixi = find_pixi()
|
||||
if not pixi:
|
||||
sys.exit("pixi not found: install it (https://pixi.sh) or pass --pixi PATH; "
|
||||
"`just install-face` passes the one on your PATH")
|
||||
"`just install` passes the one on your PATH")
|
||||
os.makedirs(env_dir, 0o755, exist_ok=True)
|
||||
for f in ("pixi.toml", "pixi.lock"):
|
||||
shutil.copyfile(os.path.join(here, f), os.path.join(env_dir, f))
|
||||
@@ -85,7 +87,7 @@ def pam_dir():
|
||||
|
||||
|
||||
if os.geteuid() != 0:
|
||||
sys.exit("run as root: run0 python3 face/install.py (or sudo), or `just install-face`")
|
||||
sys.exit("run as root: run0 python3 face/install.py (or sudo), or `just install`")
|
||||
|
||||
mod = os.path.join(pam_dir(), "pam_chandra_face.so")
|
||||
|
||||
@@ -104,6 +106,10 @@ if "--remove" in sys.argv:
|
||||
if os.path.isdir(models):
|
||||
shutil.rmtree(models)
|
||||
print("removed", models)
|
||||
try:
|
||||
os.rmdir(os.path.dirname(helper)) # /usr/local/lib/chandra, if nothing else is in it
|
||||
except OSError:
|
||||
pass
|
||||
if "--purge" in sys.argv:
|
||||
for p in (store,):
|
||||
if os.path.isdir(p):
|
||||
@@ -112,6 +118,10 @@ if "--remove" in sys.argv:
|
||||
if os.path.exists(conf):
|
||||
os.remove(conf)
|
||||
print("removed", conf)
|
||||
try:
|
||||
os.rmdir(os.path.dirname(conf)) # /etc/chandra, if nothing else is in it
|
||||
except OSError:
|
||||
pass
|
||||
sys.exit(0)
|
||||
|
||||
os.umask(0o022)
|
||||
@@ -130,13 +140,17 @@ if os.path.lexists(link):
|
||||
os.symlink(helper, link)
|
||||
print("linked", link, "->", helper)
|
||||
|
||||
src = os.path.join(here, "pam_chandra_face.c")
|
||||
built = os.path.join(os.path.dirname(here), "build", "pam_chandra_face.so") # from `just install` (same helper and python paths)
|
||||
if os.path.exists(built) and os.path.getmtime(built) >= os.path.getmtime(src):
|
||||
shutil.copyfile(built, mod + ".new")
|
||||
else:
|
||||
cc = shutil.which("cc") or shutil.which("gcc") or shutil.which("clang")
|
||||
if not cc:
|
||||
sys.exit("no C compiler: install gcc (and the libpam headers: libpam0g-dev / pam-devel)")
|
||||
subprocess.check_call([cc, "-O2", "-Wall", "-shared", "-fPIC", "-o", mod + ".new",
|
||||
"-DCHANDRA_FACE_HELPER=\"%s\"" % helper,
|
||||
"-DCHANDRA_FACE_PYTHON=\"%s\"" % py,
|
||||
os.path.join(here, "pam_chandra_face.c"), "-lpam"])
|
||||
"-DCHANDRA_FACE_PYTHON=\"%s\"" % py, src, "-lpam"])
|
||||
os.chmod(mod + ".new", 0o644)
|
||||
os.replace(mod + ".new", mod)
|
||||
print("installed", mod)
|
||||
@@ -153,8 +167,5 @@ if "--no-models" not in sys.argv:
|
||||
subprocess.check_call([py, "-I", helper, "--no-elevate", "fetch-models"])
|
||||
if "--pam" in sys.argv:
|
||||
subprocess.check_call([py, "-I", helper, "--no-elevate", "pam", "enable"])
|
||||
print("""
|
||||
Settings > Session > Face unlock comes with the session itself (the compositor, its host and the
|
||||
Settings module), not with this install: if Settings doesn't show it yet, run `just install`
|
||||
(or `just install-dev`) and log out and in again. Or enroll now from a terminal:
|
||||
`chandra-face enroll`, then `chandra-face pam enable`.""")
|
||||
print("face unlock: add a face in Settings > Session > Face unlock (after logging in to the new "
|
||||
"session), or now with `chandra-face enroll`, then `chandra-face pam enable`")
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Face unlock's Python environment (docs/face-unlock.md): `just install-face` installs it, as
|
||||
# Face unlock's Python environment (docs/face-unlock.md): `just install` installs it, as
|
||||
# root, into /usr/local/lib/chandra/face-env from this manifest and pixi.lock, so neither
|
||||
# python3-opencv nor any other distro package is needed. It is root's on purpose: the PAM module
|
||||
# runs this Python as root, so it must not live anywhere a user can write (like this checkout).
|
||||
|
||||
@@ -44,12 +44,12 @@ run: compositor-wasm wasmhost modules
|
||||
rm -f {{socket}}
|
||||
build/wasmhost build/compositor.wasm --socket {{socket}} --theme {{theme}} --window
|
||||
|
||||
# The same on the Rust host (host-wasm), kept as a fallback while the MoonBit host settles in.
|
||||
# On an X server (NVIDIA's proprietary driver, docs/x11.md): a window under a window manager, or the whole screen without one.
|
||||
run-x11: compositor-wasm wasmhost modules
|
||||
rm -f {{socket}}
|
||||
build/wasmhost build/compositor.wasm --socket {{socket}} --theme {{theme}} --x11
|
||||
|
||||
# The same on the Rust host (host-wasm), kept as a fallback while the MoonBit host settles in.
|
||||
run-rust: compositor-wasm host-wasm modules
|
||||
rm -f {{socket}}
|
||||
host-wasm/target/release/chandra-host build/compositor.wasm --socket {{socket}} --theme {{theme}} --window
|
||||
@@ -99,68 +99,53 @@ run-drm-native: build-release modules
|
||||
-dbus-update-activation-environment --systemd WAYLAND_DISPLAY=$(basename {{socket}}) XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=chandra 2>/dev/null
|
||||
{{release_exe}} --drm --socket {{socket}} --theme {{theme}}
|
||||
|
||||
# Install the Chandra login session (display-manager entry): the wasm compositor + its host (the MoonBit host). Asks for root once.
|
||||
install: compositor-wasm wasmhost modules
|
||||
scripts/as-root python3 "{{justfile_directory()}}/session/install.py"
|
||||
|
||||
# Dev install: symlink the session into this checkout, so after one root install `just compositor-wasm wasmhost modules` is all a rebuild needs.
|
||||
install-dev: compositor-wasm wasmhost modules
|
||||
scripts/as-root python3 "{{justfile_directory()}}/session/install.py" --link
|
||||
|
||||
# Install the login session with the Rust host (host-wasm) instead of the MoonBit one.
|
||||
install-rust: compositor-wasm host-wasm modules
|
||||
scripts/as-root python3 "{{justfile_directory()}}/session/install.py" --rust-host
|
||||
|
||||
# Install the login session with the native compositor instead.
|
||||
install-native: build-release modules
|
||||
scripts/as-root python3 "{{justfile_directory()}}/session/install.py" --native
|
||||
# Install everything (login session, panel modules, KDE colors, portal, face unlock); builds as you, then asks for root once. Flags: --link, --rust, --native, --pam, --no-face (docs/install.md).
|
||||
install *flags:
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
builds="compositor-wasm wasmhost modules"
|
||||
face=1
|
||||
for f in {{flags}}; do
|
||||
case "$f" in
|
||||
--rust|--native)
|
||||
[ -z "${host:-}" ] || [ "$host" = "$f" ] || { echo "just install: --rust and --native exclude each other" >&2; exit 2; }
|
||||
host=$f
|
||||
if [ "$f" = --rust ]; then builds="compositor-wasm host-wasm modules"; else builds="build-release modules"; fi ;;
|
||||
--no-face) face=0 ;;
|
||||
--link|--pam|--no-models) ;;
|
||||
*) echo "just install: unknown flag $f (--link, --rust, --native, --pam, --no-face, --no-models)" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
{{just_executable()}} --justfile "{{justfile()}}" $builds
|
||||
extra=""
|
||||
if [ "$face" = 1 ]; then
|
||||
# Build the PAM module as you, so root only copies it.
|
||||
cc=$(command -v cc || command -v gcc || command -v clang || true)
|
||||
mkdir -p build
|
||||
if [ -n "$cc" ] && "$cc" -O2 -Wall -shared -fPIC -o build/pam_chandra_face.so \
|
||||
-DCHANDRA_FACE_HELPER='"/usr/local/lib/chandra/chandra-face"' face/pam_chandra_face.c -lpam; then
|
||||
:
|
||||
else
|
||||
echo "warning: skipping face unlock: building its PAM module needs a C compiler and the libpam headers (libpam0g-dev / pam-devel)" >&2
|
||||
extra="--no-face"
|
||||
fi
|
||||
fi
|
||||
# Face unlock's Python + OpenCV come from a root-owned pixi environment: hand root our pixi.
|
||||
scripts/as-root python3 "{{justfile_directory()}}/session/install.py" {{flags}} $extra \
|
||||
--pixi "$(command -v pixi || echo "$HOME/.pixi/bin/pixi")"
|
||||
|
||||
# Reload the running session's panel modules from disk (after install or `just modules`), keeping their order and settings. `just reload clock-digital` reloads one. See docs/reloading.md.
|
||||
reload *name:
|
||||
python3 session/chandra-ctl reload {{name}}
|
||||
|
||||
# Remove the login session again.
|
||||
uninstall:
|
||||
scripts/as-root python3 "{{justfile_directory()}}/session/install.py" --remove
|
||||
|
||||
# Install face unlock (PAM module + chandra-face + models; docs/face-unlock.md). `just install-face --pam` also turns it on for polkit-1 and sudo. The Settings rows come with the session: `just install` and log in again.
|
||||
install-face *args:
|
||||
scripts/as-root python3 "{{justfile_directory()}}/face/install.py" --pixi "$(command -v pixi || echo "$HOME/.pixi/bin/pixi")" {{args}}
|
||||
|
||||
# Remove face unlock (from every PAM service first). `just uninstall-face --purge` also deletes the enrolled faces.
|
||||
uninstall-face *args:
|
||||
scripts/as-root python3 "{{justfile_directory()}}/face/install.py" --remove {{args}}
|
||||
# Remove everything `just install` installed (face unlock is taken out of every PAM service first). `just uninstall --purge` also deletes the enrolled faces and /etc/chandra/face.conf.
|
||||
uninstall *flags:
|
||||
scripts/as-root python3 "{{justfile_directory()}}/session/install.py" --remove {{flags}}
|
||||
|
||||
# Face unlock tests (fake camera; add --pam as root with pamtester to test the PAM module too).
|
||||
test-face *args:
|
||||
python3 face/test_face.py {{args}}
|
||||
|
||||
# Old names, kept so existing habits and scripts still work.
|
||||
[private]
|
||||
install-session:
|
||||
@echo "note: install-session is now 'just install'" >&2
|
||||
{{just_executable()}} --justfile "{{justfile()}}" install
|
||||
|
||||
[private]
|
||||
install-session-dev:
|
||||
@echo "note: install-session-dev is now 'just install-dev'" >&2
|
||||
{{just_executable()}} --justfile "{{justfile()}}" install-dev
|
||||
|
||||
[private]
|
||||
install-session-rust:
|
||||
@echo "note: install-session-rust is now 'just install-rust'" >&2
|
||||
{{just_executable()}} --justfile "{{justfile()}}" install-rust
|
||||
|
||||
[private]
|
||||
install-session-native:
|
||||
@echo "note: install-session-native is now 'just install-native'" >&2
|
||||
{{just_executable()}} --justfile "{{justfile()}}" install-native
|
||||
|
||||
[private]
|
||||
uninstall-session:
|
||||
@echo "note: uninstall-session is now 'just uninstall'" >&2
|
||||
{{just_executable()}} --justfile "{{justfile()}}" uninstall
|
||||
|
||||
# Start a Wayland client inside the running compositor (default: foot).
|
||||
client *cmd="foot":
|
||||
WAYLAND_DISPLAY={{socket}} {{cmd}}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Run one command as root with whatever this system uses for that: run0 (systemd 256+), else
|
||||
# sudo, doas, or pkexec. Used by `just install` and friends.
|
||||
# sudo, doas, or pkexec. Used by `just install` and `just uninstall`.
|
||||
#
|
||||
# scripts/as-root python3 session/install.py
|
||||
#
|
||||
|
||||
@@ -21,7 +21,7 @@ if [ -d "$PIXI/lib" ]; then
|
||||
fi
|
||||
moon build --target native --release --warn-list -a wasmhost/bin
|
||||
mkdir -p build
|
||||
# Replace it by renaming, so a running session (install-dev links to it) keeps its copy.
|
||||
# Replace it by renaming, so a running session (`just install --link` links to it) keeps its copy.
|
||||
cp _build/native/release/build/wasmhost/bin/bin.exe build/wasmhost.new
|
||||
mv -f build/wasmhost.new build/wasmhost
|
||||
echo "build/wasmhost $(stat -c %s build/wasmhost) bytes"
|
||||
+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)
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
The host that runs the compositor component (`build/compositor.wasm`): `just run`, `just run-drm`
|
||||
and `just install` use it. It replaces the Rust `host-wasm/`, which stays as a fallback
|
||||
(`just run-rust`, `just run-drm-rust`, `just install-rust`).
|
||||
(`just run-rust`, `just run-drm-rust`, `just install --rust`).
|
||||
|
||||
It links wasmtime as the prebuilt C API library (`libwasmtime.a` from the upstream
|
||||
`wasmtime-v$WASMTIME_VERSION-x86_64-linux-c-api` release, fetched by `scripts/setup-toolchain.sh`
|
||||
|
||||
@@ -348,7 +348,7 @@ interface face-unlock {
|
||||
/// What the running change said last ("Look at the camera… 3/5"), or how the last one
|
||||
/// ended; empty when none ran.
|
||||
message: string,
|
||||
/// chandra-face is installed (`just install-face`).
|
||||
/// chandra-face is installed (`just install`).
|
||||
installed: bool,
|
||||
/// The password dialog (PAM service polkit-1) and sudo try the face first.
|
||||
in-use: bool,
|
||||
|
||||
Reference in new issue
Block a user