summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authordankm <dan.mcgregor@usask.ca>2023-04-28 15:10:34 -0600
committerGitHub <noreply@github.com>2023-04-28 16:10:34 -0500
commit5abf5f5f2cf93c57ac74220251d2a2acce5f7099 (patch)
tree7b5793cc82d537714e369b5f800d504e282599fb /setup.py
parent7ffd0bcd8379ae6ece096e7014444978efa5f7c8 (diff)
downloadcloud-init-git-5abf5f5f2cf93c57ac74220251d2a2acce5f7099.tar.gz
setup.py: use pkg-config for udev/rules path (#2137)
Distributions other than RHEL also use /usr/lib/udev for the rules path. Instead of hardcoding the udev rules path for RedHat, check pkg-config for the proper location.
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/setup.py b/setup.py
index 8919c384..d0b1c996 100644
--- a/setup.py
+++ b/setup.py
@@ -46,7 +46,10 @@ def pkg_config_read(library, var):
"systemdsystemconfdir": "/etc/systemd/system",
"systemdsystemunitdir": "/lib/systemd/system",
"systemdsystemgeneratordir": "/lib/systemd/system-generators",
- }
+ },
+ "udev": {
+ "udevdir": "/lib/udev",
+ },
}
cmd = ["pkg-config", "--variable=%s" % var, library]
try:
@@ -307,14 +310,13 @@ data_files = [
),
]
if not platform.system().endswith("BSD"):
-
- RULES_PATH = LIB
- if os.path.isfile("/etc/redhat-release"):
- RULES_PATH = "/usr/lib"
+ RULES_PATH = pkg_config_read("udev", "udevdir")
+ if not in_virtualenv():
+ RULES_PATH = "/" + RULES_PATH
data_files.extend(
[
- (RULES_PATH + "/udev/rules.d", [f for f in glob("udev/*.rules")]),
+ (RULES_PATH + "/rules.d", [f for f in glob("udev/*.rules")]),
(
ETC + "/systemd/system/sshd-keygen@.service.d/",
["systemd/disable-sshd-keygen-if-cloud-init-active.conf"],