| 12345678910111213141516171819202122232425262728293031323334353637 |
- #!/bin/bash
- # Install the phase-1 fprintd shim: serve net.reactivated.Fprint from
- # work/fprintd-shim instead of the packaged fprintd daemon, so GNOME Shell
- # (lock screen), pam_fprintd and fprintd-* tools see the 06cb:0081 sensor.
- #
- # Rollback: work/fprintd-shim/uninstall.sh
- set -euo pipefail
- SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
- UNIT=/etc/systemd/system/fprintd.service
- if [ "$(id -u)" != "0" ]; then
- echo "install.sh: run as root (sudo $0)" >&2
- exit 1
- fi
- command -v python3 >/dev/null || { echo "install.sh: python3 missing" >&2; exit 1; }
- python3 -c 'import gi; gi.require_version("Gio", "2.0"); from gi.repository import Gio' \
- || { echo "install.sh: python-gobject (gi) is required" >&2; exit 1; }
- [ -e /usr/lib/security/pam_fprintd.so ] \
- || echo "install.sh: warning: pam_fprintd.so not found (install the fprintd package)"
- chmod +x "$SELF_DIR/fprintd-shim.py" "$SELF_DIR/run.sh" "$SELF_DIR/selftest.py"
- python3 -B -m py_compile "$SELF_DIR/fprintd-shim.py"
- rm -rf "$SELF_DIR/__pycache__" # py_compile as root must not leave root-owned files
- echo "installing $UNIT (shadows the packaged fprintd.service)"
- install -m 0644 "$SELF_DIR/fprintd.service" "$UNIT"
- systemctl daemon-reload
- systemctl stop fprintd 2>/dev/null || true
- systemctl start fprintd
- sleep 0.3
- systemctl --no-pager --full status fprintd | head -n 12 || true
- echo
- echo "Installed. Smoke test (as your user): fprintd-list \$USER"
- echo "Rollback: sudo $SELF_DIR/uninstall.sh"
|