Blame SOURCES/bz1227293-dhcpd-chroot-fix.patch.patch

261ad6
From 6f8a0aa5c0f6c1e4965e4ce10d62ba83ae9f834e Mon Sep 17 00:00:00 2001
261ad6
From: David Vossel <dvossel@redhat.com>
261ad6
Date: Mon, 29 Jun 2015 13:10:42 -0500
261ad6
Subject: [PATCH 3/3] bz1227293-dhcpd-chroot-fix.patch
261ad6
261ad6
---
261ad6
 heartbeat/dhcpd | 12 ++++++++++--
261ad6
 1 file changed, 10 insertions(+), 2 deletions(-)
261ad6
261ad6
diff --git a/heartbeat/dhcpd b/heartbeat/dhcpd
261ad6
index 67b529e..89a9578 100755
261ad6
--- a/heartbeat/dhcpd
261ad6
+++ b/heartbeat/dhcpd
261ad6
@@ -38,6 +38,14 @@ OCF_RESKEY_leases_default="/db/dhcpd.leases"
261ad6
 OCF_RESKEY_interface_default=""
261ad6
 OCF_RESKEY_includes_default=""
261ad6
 
261ad6
+# On some systems, the chrooted default is slightly different.
261ad6
+# Lets do our best to support both by default.
261ad6
+if [ ! -d "$OCF_RESKEY_chrooted_path_default" ]; then
261ad6
+	if [ -d "/var/lib/dhcpd" ]; then
261ad6
+		OCF_RESKEY_chrooted_path_default="/var/lib/dhcpd"
261ad6
+	fi
261ad6
+fi
261ad6
+
261ad6
 : ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
261ad6
 : ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
261ad6
 : ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
261ad6
@@ -302,7 +310,7 @@ dhcpd_initialize_chroot() {
261ad6
 	    { ocf_exit_reason "could not copy $i to chroot jail"; return $OCF_ERR_GENERIC; }
261ad6
     done
261ad6
 
261ad6
-    libdir=$(basename $(echo /var/lib/dhcp/lib*))
261ad6
+    libdir=$(basename $(echo ${OCF_RESKEY_chrooted_path}/lib*))
261ad6
     if test -x /usr/bin/ldd ; then
261ad6
 	get_ldd_deps()
261ad6
 	{
261ad6
@@ -327,7 +335,7 @@ dhcpd_initialize_chroot() {
261ad6
     done | sort -u`
261ad6
     for i in $cplibs ; do
261ad6
 	if [ -s "$i" ]; then
261ad6
-	    cp -pL "$i" "/var/lib/dhcp/$libdir/" ||
261ad6
+	    cp -pL "$i" "${OCF_RESKEY_chrooted_path}/$libdir/" ||
261ad6
 		{ ocf_exit_reason "could not copy $i to chroot jail"; return $OCF_ERR_GENERIC; }
261ad6
 	fi
261ad6
     done
261ad6
-- 
261ad6
1.8.4.2
261ad6