From 1350a6faeaaf2dd20178c2cad5a3caf0b5617c6a Mon Sep 17 00:00:00 2001 From: immarvin Date: Thu, 29 May 2014 02:52:35 -0700 Subject: [PATCH] correct xCATsn.spec to support apache2/httpd 2.4.x --- xCATsn/xCATsn.spec | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index 2e514c536..0fd02f9f0 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -15,6 +15,7 @@ Source1: xcat.conf Source2: license.tar.gz Source3: xCATSN Source5: templates.tar.gz +Source6: xcat.conf.apach24 Provides: xCATsn = %{version} Requires: xCAT-server xCAT-client perl-DBD-SQLite @@ -80,6 +81,7 @@ tar -xf license.tar %install %ifos linux +mkdir -p $RPM_BUILD_ROOT/etc/xcat/conf.orig mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d/ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ @@ -87,6 +89,8 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ cp %{SOURCE1} $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat.conf cp %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf cp %{SOURCE3} $RPM_BUILD_ROOT/etc/xCATSN +cp %{SOURCE1} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach22 +cp %{SOURCE6} $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat.conf.apach24 mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT @@ -122,6 +126,23 @@ fi %endif %post +%ifos linux +#Apply the correct httpd/apache configuration file according to the httpd/apache version +if [ -n "$(httpd -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] +then + rm -rf /etc/httpd/conf.d/xcat.conf + cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/httpd/conf.d/xcat.conf +fi + +if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ] +then + rm -rf /etc/apache2/conf.d/xcat.conf + cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf +fi + + +%endif + # create dir for the current pid and move the original ones from /tmp/xcat to /var/run/xcat mkdir -p /var/run/xcat if [ -r "/tmp/xcat/installservice.pid" ]; then @@ -161,7 +182,6 @@ if [ -e "/etc/redhat-release" ]; then else # SuSE apachedaemon='apache2' fi - # start xcatd on linux chkconfig $apachedaemon on if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image @@ -199,6 +219,8 @@ fi %{prefix} # one for sles, one for rhel. yes, it's ugly... %ifos linux +/etc/xcat/conf.orig/xcat.conf.apach24 +/etc/xcat/conf.orig/xcat.conf.apach22 /etc/httpd/conf.d/xcat.conf /etc/apache2/conf.d/xcat.conf %endif