Hi,

Here is a patch to oscar to fix dhcpd.conf path.

it was hardcoded to /etc/dhcpd.conf or checking /etc/dhcp3/ dir for debian 
systems, but that wasn't consistent among all oscar perl files and RHEL6 wasn't 
handeled. (/etc/dhcp/dhcpd.conf

This patch fixes this issue hopefully in all oscar subsystems.

Olivier.

--
   Olivier LAHAYE
   CEA DRT/LIST/DCSI/DIR
Index: oscar/lib/OSCAR/MAC.pm
===================================================================
--- oscar/lib/OSCAR/MAC.pm	(révision 9443)
+++ oscar/lib/OSCAR/MAC.pm	(copie de travail)
@@ -128,6 +128,8 @@
         or (carp "ERROR: Couldn't clean hosts file!", return -1);
 
     my $dhcpd_configfile = "/etc/dhcpd.conf";
+    # Under RHEL6 like, the dhcpd config file is in /etc/dhcp
+    $dhcpd_configfile = "/etc/dhcp/dhcpd.conf" if -x "/etc/dhcp";
     # Under Debian the dhcpd config file is in /etc/dhcp3
     $dhcpd_configfile = "/etc/dhcp3/dhcpd.conf" if -x "/etc/dhcp3";
     oscar_log_subsection ("Step $step_number: About to run setup_dhcpd...");
Index: oscar/lib/OSCAR/NodeMgt.pm
===================================================================
--- oscar/lib/OSCAR/NodeMgt.pm	(révision 9443)
+++ oscar/lib/OSCAR/NodeMgt.pm	(copie de travail)
@@ -368,7 +368,16 @@
     OSCAR::SystemServices::system_service (OSCAR::SystemServicesDefs::DHCP(),
             OSCAR::SystemServicesDefs::START());
     my ($ip, $broadcast, $netmask) = OSCAR::Network::interface2ip($interface);
-    $cmd = "mkdhcpconf -o /etc/dhcpd.conf --interface=$interface --gateway=$ip";
+    my $dhcpd_configfile = "/etc/dhcpd.conf";
+    # Under RHEL6 like, the dhcpd config file is in /etc/dhcp
+    $dhcpd_configfile = "/etc/dhcp/dhcpd.conf" if -x "/etc/dhcp";
+    # Under Debian the dhcpd config file is in /etc/dhcp3
+    $dhcpd_configfile = "/etc/dhcp3/dhcpd.conf" if -x "/etc/dhcp3";
+    if(-e $dhcpd_configfile) {
+        copy($dhcpd_configfile, $dhcpd_configfile.".oscarbak")
+        or (carp "ERROR: Couldn't backup dhcpd.conf file", return -1);
+    }
+    $cmd = "mkdhcpconf -o $dhcpd_configfile --interface=$interface --gateway=$ip";
     if ($install_mode eq "systemimager-multicast") {
        $cmd = $cmd . " --multicast=yes";
     }
Index: oscar/scripts/update_live_macs
===================================================================
--- oscar/scripts/update_live_macs	(révision 9443)
+++ oscar/scripts/update_live_macs	(copie de travail)
@@ -102,8 +102,15 @@
 #   find default gateway in /etc/dhcpd.conf
 # TODO: We should use OS_Settings here
 my $dhcpd_configfile = "/etc/dhcpd.conf";
+# Under RHEL6 like, the dhcpd config file is in /etc/dhcp
+$dhcpd_configfile = "/etc/dhcp/dhcpd.conf" if -x "/etc/dhcp";
 # Under Debian the dhcpd config file is in /etc/dhcp3
 $dhcpd_configfile = "/etc/dhcp3/dhcpd.conf" if -x "/etc/dhcp3";
+if(-e $dhcpd_configfile) {
+    copy($dhcpd_configfile, $dhcpd_configfile.".oscarbak")
+        or (die "ERROR: Couldn't backup $dhcpd_configfile file");
+}
+
 open IN, "$dhcpd_configfile" or die "ERROR: Could not open $dhcpd_configfile!";
 my ($gwip, $netmask);
 while (<IN>) {
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Oscar-devel mailing list
Oscar-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oscar-devel

Reply via email to