summaryrefslogtreecommitdiffstats
path: root/scripts/postinst-intercepts/update_udev_hwdb
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/postinst-intercepts/update_udev_hwdb')
-rw-r--r--scripts/postinst-intercepts/update_udev_hwdb25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/postinst-intercepts/update_udev_hwdb b/scripts/postinst-intercepts/update_udev_hwdb
new file mode 100644
index 0000000000..8b3f5de791
--- /dev/null
+++ b/scripts/postinst-intercepts/update_udev_hwdb
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# SPDX-License-Identifier: MIT
+#
+
+set -e
+
+case "${PREFERRED_PROVIDER_udev}" in
+ systemd)
+ UDEV_EXTRA_ARGS="--usr"
+ UDEVLIBDIR="${rootlibexecdir}"
+ UDEVADM="${base_bindir}/udevadm"
+ ;;
+
+ *)
+ UDEV_EXTRA_ARGS=""
+ UDEVLIBDIR="${sysconfdir}"
+ UDEVADM="${bindir}/udevadm"
+ ;;
+esac
+
+rm -f $D${UDEVLIBDIR}/udev/hwdb.bin
+PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS} ||
+ PSEUDO_UNLOAD=1 qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS}
+chown root:root $D${UDEVLIBDIR}/udev/hwdb.bin