xref: /OK3568_Linux_fs/yocto/poky/scripts/postinst-intercepts/update_udev_hwdb (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2#
3# SPDX-License-Identifier: MIT
4#
5
6set -e
7
8case "${PREFERRED_PROVIDER_udev}" in
9	systemd)
10		UDEV_EXTRA_ARGS="--usr"
11		UDEVLIBDIR="${rootlibexecdir}"
12		UDEVADM="${base_bindir}/udevadm"
13		;;
14
15	*)
16		UDEV_EXTRA_ARGS=""
17		UDEVLIBDIR="${sysconfdir}"
18		UDEVADM="${bindir}/udevadm"
19		;;
20esac
21
22rm -f $D${UDEVLIBDIR}/udev/hwdb.bin
23PSEUDO_UNLOAD=1 ${binprefix}qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS} ||
24	PSEUDO_UNLOAD=1 qemuwrapper -L $D $D${UDEVADM} hwdb --update --root $D ${UDEV_EXTRA_ARGS}
25chown root:root $D${UDEVLIBDIR}/udev/hwdb.bin
26