fingerprintd/packaging/fingerprintd.post-upgrade

21 lines
1.1 KiB
Text
Raw Normal View History

#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-only
# SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts®
#
# Two things an upgrade must do on a running phone. First re-derive the
# trustlet from the active slot: 0.2.3 pinned one Android build's hash, so a
# phone on any other build has no trustlet, or a hand-placed one, and
# --refresh replaces it with the phone's own (fp6 journal, fingerprint lane,
# 2026-09-11). --if-device keeps this a no-op inside build/CI chroots.
/usr/lib/fp6-vendor-blobs/extract --if-device --refresh || :
#
# Then restart the daemon: apk replaces /usr/bin/fingerprintd on disk and
# leaves the running one alone, so the phone would keep matching with the OLD
# code until a reboot (how 0.2.2's FingerMatched signal first presented,
# 2026-09-05). A plain restart rather than try-restart: a daemon that exited
# on a refused trustlet is not running and must come up on the re-derived
# file, and the unit's ConditionPathExists lines keep this inert on a phone
# with no trustlet or no /dev/tee0. No systemd inside a chroot.
[ -d /run/systemd/system ] || exit 0
systemctl restart fingerprintd.service 2>/dev/null || :
exit 0