Skip to content

Instantly share code, notes, and snippets.

@siddhpant
Forked from giannello/setup.sh
Last active December 20, 2023 19:28
Show Gist options
  • Save siddhpant/8490545139ef7528afe80fda222327a3 to your computer and use it in GitHub Desktop.
Save siddhpant/8490545139ef7528afe80fda222327a3 to your computer and use it in GitHub Desktop.
Install fprintd-tod with support for Broadcom readers on Debian testing
#!/usr/bin/env sh
# ONLY FOR DEBIAN, NOT FOR UBUNTU!
# ONLY FOR DEBIAN, NOT FOR UBUNTU!
# ONLY FOR DEBIAN, NOT FOR UBUNTU!
# ONLY FOR DEBIAN, NOT FOR UBUNTU!
# ONLY FOR DEBIAN, NOT FOR UBUNTU!
set -eux pipefail
echo "Assuming the packages fprintd, libpam-fprintd, libfprint-2-2 are installed."
sudo apt-get install \
meson gtk-doc-tools libgudev-1.0-dev libnss3-dev libgusb-dev \
libpixman-1-dev libglib2.0-dev libgirepository1.0-dev libcairo2-dev
TEMPDIR=$(mktemp -d)
cd "${TEMPDIR}"
# Clone the closed-source library and firmware
git clone --depth=1 --branch jammy \
git://git.launchpad.net/libfprint-2-tod1-broadcom
cd libfprint-2-tod1-broadcom
src_dir="lib/udev/rules.d"
dest_dir="/usr/lib/udev/rules.d"
filename="60-libfprint-2-device-broadcom.rules"
sudo cp "$src_dir/$filename" "$dest_dir/$filename"
sudo chown -R root:root "$dest_dir/$filename"
src_dir="usr/lib/x86_64-linux-gnu/libfprint-2/tod-1"
dest_dir="/usr/lib/x86_64-linux-gnu/libfprint-2/tod-1"
filename="libfprint-2-tod-1-broadcom.so"
sudo mkdir -p "$dest_dir"
sudo cp "$src_dir/$filename" "$dest_dir/$filename"
sudo chown -R root:root "$dest_dir/$filename"
sudo cp -r var/lib/fprint/fw /var/lib/fprint/
sudo chown -R root:root /var/lib/fprint/fw
# Clone libfprint, switch to the correct tag, patch and build
LIBFPRINT_VERSION=$(dpkg-query --showformat='${Version}' --show libfprint-2-2 \
| cut -d '-' -f 1 | cut -d ":" -f 2)
cd "${TEMPDIR}"
git clone --branch v${LIBFPRINT_VERSION}+tod1 --depth=1 \
https://gitlab.freedesktop.org/3v1n0/libfprint.git
cd "${TEMPDIR}"/libfprint
meson build --prefix=/usr
cd build
meson compile
src_dir="libfprint/tod"
dest_dir="/usr/lib/x86_64-linux-gnu"
sudo cp "$src_dir/libfprint-2-tod.so.1" "$dest_dir/libfprint-2-tod.so.1"
sudo chown root:root "$dest_dir/libfprint-2-tod.so.1"
sudo ln -sf "$dest_dir/libfprint-2-tod.so.1" "$dest_dir/libfprint-2-tod.so"
src_dir="libfprint"
dest_dir="/usr/lib/x86_64-linux-gnu"
sudo cp "$src_dir/libfprint-2.so.2" "$dest_dir/libfprint-2.so.2"
sudo chown root:root "$dest_dir/libfprint-2.so.2"
cd "${TEMPDIR}"
# Configure fprintd to not sleep
sudo mkdir -p /etc/systemd/system/fprintd.service.d
cat > override.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/libexec/fprintd --no-timeout
EOF
sudo cp override.conf /etc/systemd/system/fprintd.service.d/override.conf
sudo udevadm control --reload-rules
sudo systemctl daemon-reload
sudo systemctl restart fprintd
rm -rf "${TEMPDIR}"
echo "Done! Shutdown and start again to get it working."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment