summaryrefslogtreecommitdiffstats
path: root/scripts/postinst-intercepts/update_udev_hwdb
blob: 8b3f5de791fe58494e3110f09846807797473b36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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