mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-30 10:01:32 +02:00
eclass/udev: Sync with gentoo
It's from gentoo commit 3fc8be35607dc65897279f666c8171b174dd2bf2.
This commit is contained in:
parent
d67c558126
commit
237eaf7d8c
@ -1,10 +1,10 @@
|
||||
# Copyright 1999-2018 Gentoo Authors
|
||||
# Copyright 1999-2021 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# @ECLASS: udev.eclass
|
||||
# @MAINTAINER:
|
||||
# udev-bugs@gentoo.org
|
||||
# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
|
||||
# systemd@gentoo.org
|
||||
# @SUPPORTED_EAPIS: 5 6 7 8
|
||||
# @BLURB: Default eclass for determining udev directories.
|
||||
# @DESCRIPTION:
|
||||
# Default eclass for determining udev directories.
|
||||
@ -28,18 +28,17 @@
|
||||
# }
|
||||
# @CODE
|
||||
|
||||
case ${EAPI} in
|
||||
5|6|7|8) ;;
|
||||
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
|
||||
esac
|
||||
|
||||
if [[ -z ${_UDEV_ECLASS} ]]; then
|
||||
_UDEV_ECLASS=1
|
||||
|
||||
inherit toolchain-funcs
|
||||
|
||||
case ${EAPI:-0} in
|
||||
0|1|2|3|4|5|6|7) ;;
|
||||
*) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
|
||||
esac
|
||||
|
||||
if [[ ${EAPI:-0} == [0123456] ]]; then
|
||||
RDEPEND=""
|
||||
if [[ ${EAPI} == [56] ]]; then
|
||||
DEPEND="virtual/pkgconfig"
|
||||
else
|
||||
BDEPEND="virtual/pkgconfig"
|
||||
@ -50,6 +49,8 @@ fi
|
||||
# @DESCRIPTION:
|
||||
# Get unprefixed udevdir.
|
||||
_udev_get_udevdir() {
|
||||
# https://github.com/pkgconf/pkgconf/issues/205
|
||||
local -x PKG_CONFIG_FDO_SYSROOT_RULES=1
|
||||
if $($(tc-getPKG_CONFIG) --exists udev); then
|
||||
local udevdir="$($(tc-getPKG_CONFIG) --variable=udevdir udev)"
|
||||
echo "${udevdir#${EPREFIX%/}}"
|
||||
@ -80,10 +81,9 @@ get_udevdir() {
|
||||
}
|
||||
|
||||
# @FUNCTION: udev_dorules
|
||||
# @USAGE: rules [...]
|
||||
# @USAGE: <rule> [...]
|
||||
# @DESCRIPTION:
|
||||
# Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
|
||||
# and non-fatal in earlier EAPIs.
|
||||
# Install udev rule(s). Uses doins, thus it is fatal.
|
||||
udev_dorules() {
|
||||
debug-print-function ${FUNCNAME} "${@}"
|
||||
|
||||
@ -95,10 +95,9 @@ udev_dorules() {
|
||||
}
|
||||
|
||||
# @FUNCTION: udev_newrules
|
||||
# @USAGE: oldname newname
|
||||
# @USAGE: <oldname> <newname>
|
||||
# @DESCRIPTION:
|
||||
# Install udev rule with a new name. Uses newins, thus it is fatal
|
||||
# in EAPI 4 and non-fatal in earlier EAPIs.
|
||||
# Install udev rule with a new name. Uses newins, thus it is fatal.
|
||||
udev_newrules() {
|
||||
debug-print-function ${FUNCNAME} "${@}"
|
||||
|
||||
@ -113,7 +112,7 @@ udev_newrules() {
|
||||
# @DESCRIPTION:
|
||||
# Run udevadm control --reload to refresh rules and databases
|
||||
udev_reload() {
|
||||
if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
|
||||
if [[ -n ${ROOT%/} ]]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user