#!/usr/bin/bash set -euo pipefail if [[ ${EUID} -ne 0 ]]; then echo 'Run as root after building: sudo ./scripts/install.sh' >&2 exit 1 fi project_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" if [[ ! -x "$project_dir/target/release/fingerprint-switch" ]]; then echo 'First build as your normal user: cargo build --release --locked' >&2 exit 1 fi if [[ ! -f /usr/lib/systemd/system/fprintd.service ]]; then echo 'This integration expects the Fedora/Aurora fprintd.service. Install fprintd first.' >&2 exit 1 fi # Install only our executable, service and named drop-in. Do not edit PAM or the # vendor service, and never run the build toolchain as root. /usr/bin/install -D -m 0755 "$project_dir/target/release/fingerprint-switch" /usr/local/bin/fingerprint-switch /usr/bin/install -D -m 0644 "$project_dir/deploy/fingerprint-switch.service" /etc/systemd/system/fingerprint-switch.service /usr/bin/install -D -m 0644 "$project_dir/deploy/fprintd-override.conf" /etc/systemd/system/fprintd.service.d/60-fingerprint-switch.conf /usr/bin/install -d -m 0755 /etc/fingerprint-switch if [[ ! -e /etc/fingerprint-switch/mode ]]; then /usr/local/bin/fingerprint-switch mode auto fi /usr/bin/systemctl daemon-reload /usr/bin/systemctl enable fingerprint-switch.service /usr/bin/systemctl restart fingerprint-switch.service # An existing daemon may predate our EnvironmentFile drop-in. Subsequent # changes are handled by the watcher; a fresh D-Bus activation needs no restart. /usr/bin/systemctl try-restart fprintd.service echo 'Installed. An active fprintd has been restarted; future routing changes are handled by the watcher.' echo 'Check: fingerprint-switch status' echo 'Logs: journalctl -u fingerprint-switch -n 30 --no-pager' echo 'Restore access to both readers: sudo fingerprint-switch mode both'