One install recipe: just install installs everything
CI / test (push) Successful in 2m25s

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:
Claude committed 2026-11-26 01:38:58 +00:00
1 parent e6be3825d0
commit 3e35c4dfa5
16 files changed
+171 -108

No files matched your search

+29 -18
View File
@@ -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)
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"])
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, 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`")