Add fingerprint reader selection and lid-based routing
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/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'
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ ${EUID} -ne 0 ]]; then
|
||||
echo 'Run as root: sudo ./scripts/uninstall.sh' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
/usr/bin/systemctl disable --now fingerprint-switch.service
|
||||
/usr/bin/rm -f /etc/systemd/system/fprintd.service.d/60-fingerprint-switch.conf
|
||||
/usr/bin/rm -f /etc/systemd/system/fingerprint-switch.service
|
||||
/usr/bin/rm -f /usr/local/bin/fingerprint-switch
|
||||
/usr/bin/rm -f /run/fingerprint-switch/fprintd.env
|
||||
/usr/bin/systemctl daemon-reload
|
||||
/usr/bin/systemctl try-restart fprintd.service
|
||||
echo 'Removed automatic routing. Stock fprintd sees both readers again.'
|
||||
echo 'Enrollments and /etc/fingerprint-switch/mode were preserved.'
|
||||
Reference in New Issue
Block a user