314d24
From ed7060ac1d5003f70fc3da4d6006a1a958a47b04 Mon Sep 17 00:00:00 2001
314d24
From: Emanuele Giuseppe Esposito <eesposit@redhat.com>
314d24
Date: Mon, 20 Jun 2022 10:31:14 +0200
314d24
Subject: [PATCH 2/2] setup.py: adjust udev/rules default path (#1513)
314d24
314d24
RH-Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
314d24
RH-MergeRequest: 80: setup.py: adjust udev/rules default path (#1513)
314d24
RH-Commit: [2/2] 2cb64b004acbe1b6a30f943b0da51d2d1f2f0d50 (eesposit/cloud-init)
314d24
RH-Bugzilla: 2096269
314d24
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
314d24
RH-Acked-by: Mohamed Gamal Morsy <mmorsy@redhat.com>
314d24
314d24
commit 70715125f3af118ae242770e61064c24f41e9a02
314d24
Author: Emanuele Giuseppe Esposito <eesposit@redhat.com>
314d24
Date:   Thu Jun 16 20:39:42 2022 +0200
314d24
314d24
    setup.py: adjust udev/rules default path (#1513)
314d24
314d24
    RHEL must put cloudinit .rules files in /usr/lib/udev/rules.d
314d24
    This place is a rhel standard and since it is used by all packages
314d24
    cannot be modified.
314d24
314d24
    Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
314d24
314d24
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
314d24
---
314d24
 setup.py | 7 ++++++-
314d24
 1 file changed, 6 insertions(+), 1 deletion(-)
314d24
314d24
diff --git a/setup.py b/setup.py
314d24
index a9132d2c..fdf27cd7 100755
314d24
--- a/setup.py
314d24
+++ b/setup.py
314d24
@@ -302,6 +302,11 @@ data_files = [
314d24
     ),
314d24
 ]
314d24
 if not platform.system().endswith("BSD"):
314d24
+
314d24
+    RULES_PATH = LIB
314d24
+    if os.path.isfile("/etc/redhat-release"):
314d24
+        RULES_PATH = "/usr/lib"
314d24
+
314d24
     data_files.extend(
314d24
         [
314d24
             (
314d24
@@ -309,7 +314,7 @@ if not platform.system().endswith("BSD"):
314d24
                 ["tools/hook-network-manager"],
314d24
             ),
314d24
             (ETC + "/dhcp/dhclient-exit-hooks.d/", ["tools/hook-dhclient"]),
314d24
-            (LIB + "/udev/rules.d", [f for f in glob("udev/*.rules")]),
314d24
+            (RULES_PATH + "/udev/rules.d", [f for f in glob("udev/*.rules")]),
314d24
             (
314d24
                 ETC + "/systemd/system/sshd-keygen@.service.d/",
314d24
                 ["systemd/disable-sshd-keygen-if-cloud-init-active.conf"],
314d24
-- 
314d24
2.31.1
314d24