mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2026-06-11 02:28:05 +00:00
debian: Generate postinst devices list automatically at gbp import phase
Alternatively provide a script to keep the post-inst script updated
This commit is contained in:
Vendored
+7
-16
@@ -1,19 +1,10 @@
|
||||
The libfprint0 postinst script calls udevadmin trigger for all the supported
|
||||
USB readers. The list of readers used in that file is generated by calling the
|
||||
following awk script:
|
||||
The libfprint-2-2 postinst script calls udevadmin trigger for all the supported
|
||||
USB readers. The list of readers used in that file is generated using the gbp
|
||||
import hook when `gbp import-orig` (via --uscan or with a tarball) is used.
|
||||
|
||||
/plugdev/ {
|
||||
printf ("\tudevadm trigger --action=add " )
|
||||
for (i=1;i<=NF; i++){
|
||||
if (match($i,/idVendor/)>0) {
|
||||
match($i, /"[^"]*"/); printf ("--attr-match=idVendor=%s ",substr($i,RSTART+1,RLENGTH-2))
|
||||
}
|
||||
if (match($i,/idProduct/)>0) {
|
||||
match($i, /"[^"]*"/); printf ("--attr-match=idProduct=%s",substr($i,RSTART+1,RLENGTH-2))
|
||||
}
|
||||
};
|
||||
printf("\n")
|
||||
}
|
||||
Alternatively it can be called manually by using:
|
||||
|
||||
GBP_SOURCES_DIR=. debian/update-udev-triggers.sh
|
||||
|
||||
When preparing a new upstream release, this script should be called against the
|
||||
udev .rules file generated during the build of the package
|
||||
upstream provided .hwdb file.
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
dch -v"$GBP_DEBIAN_VERSION" "New upstream release"
|
||||
git add debian/changelog
|
||||
debcommit
|
||||
|
||||
debian/update-udev-triggers.sh
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@ sign-tags = True
|
||||
multimaint-merge = True
|
||||
|
||||
[import-orig]
|
||||
postimport = dch -v%(version)s New upstream release; git add debian/changelog; debcommit
|
||||
postimport = debian/gbp-post-import-hook.sh
|
||||
|
||||
[pq]
|
||||
patch-numbers = False
|
||||
|
||||
Vendored
+3
-1
@@ -5,10 +5,12 @@ set -e
|
||||
#DEBHELPER#
|
||||
|
||||
if [ "$1" = "configure" -o "$1" = "upgrade" ] && command -V udevadm >/dev/null 2>&1; then
|
||||
# apply udev rules at package installation, see
|
||||
# apply hwdb rules at package installation, see
|
||||
# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683863#27>
|
||||
# NOTA BENE: after the DEBHELPER section since dh_installudev
|
||||
# adds stuff there
|
||||
# The devices ID list is auto-generated using the gbp postimport hook
|
||||
# see debian/README.sources for more details.
|
||||
udevadm trigger --action=add --attr-match=idVendor=147e --attr-match=idProduct=2016
|
||||
udevadm trigger --action=add --attr-match=idVendor=147e --attr-match=idProduct=2020
|
||||
udevadm trigger --action=add --attr-match=idVendor=138a --attr-match=idProduct=0010
|
||||
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
if [ "$1" = "configure" -o "$1" = "upgrade" ] && command -V udevadm >/dev/null 2>&1; then
|
||||
# apply hwdb rules at package installation, see
|
||||
# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683863#27>
|
||||
# NOTA BENE: after the DEBHELPER section since dh_installudev
|
||||
# adds stuff there
|
||||
# The devices ID list is auto-generated using the gbp postimport hook
|
||||
# see debian/README.sources for more details.
|
||||
${UDEVADM_TRIGGERS}
|
||||
fi
|
||||
|
||||
exit 0
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
srcdir="${GBP_SOURCES_DIR:-.}"
|
||||
debpath="$(dirname "$0")"
|
||||
autosuspend_file="$srcdir/data/autosuspend.hwdb"
|
||||
commands_lines=()
|
||||
|
||||
while IFS= read -r line; do
|
||||
if [[ $line =~ ^usb:v([A-Fa-f0-9]{4})p([A-Fa-f0-9]{4}) ]]; then
|
||||
vendor="$(echo "${BASH_REMATCH[1]}" | tr '[:upper:]' '[:lower:]')"
|
||||
product="$(echo "${BASH_REMATCH[2]}" | tr '[:upper:]' '[:lower:]')"
|
||||
commands_lines+=("\tudevadm trigger --action=add --attr-match=idVendor=$vendor --attr-match=idProduct=$product")
|
||||
fi
|
||||
done < "$autosuspend_file"
|
||||
|
||||
export UDEVADM_TRIGGERS=$( IFS=$'\n'; echo -e "${commands_lines[*]}" )
|
||||
|
||||
for i in $debpath/libfprint-*.post*.in; do
|
||||
out="${i%.in}"
|
||||
envsubst < "$i" > "$out"
|
||||
|
||||
if [ -n "$GBP_BRANCH" ]; then
|
||||
if ! git diff-index --quiet HEAD -- "$out"; then
|
||||
git add "$out"
|
||||
dch "${out#$srcdir}: Devices triggers updated"
|
||||
git add debian/changelog
|
||||
debcommit
|
||||
fi
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user