From 896877deb7ebef264a46a67743db80af059a81a0 Mon Sep 17 00:00:00 2001 From: Casandra Qiu Date: Wed, 15 Apr 2015 14:08:40 -0400 Subject: [PATCH] Bug #4642 httpd didn't start up for rhels7.1 diskless server node --- xCATsn/xCATsn.spec | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/xCATsn/xCATsn.spec b/xCATsn/xCATsn.spec index df24475ab..e617c3012 100644 --- a/xCATsn/xCATsn.spec +++ b/xCATsn/xCATsn.spec @@ -137,16 +137,22 @@ fi %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 + +compare_version="2.4" +version=`rpm -qi httpd 2>&1 | grep 'Version' | awk '$NF { print $3 }' | cut -d. -f1,2` +if [ -n "$version" ]; then + if (( `bc <<< "$version >= $compare_version"` )); then + rm -rf /etc/httpd/conf.d/xcat.conf + cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/httpd/conf.d/xcat.conf + fi 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 +version=`rpm -qi apache2 2>&1 | grep '^Version' | awk '$NF { print $3 }' | cut -d. -f1,2` +if [ -n "$version" ]; then + if (( `bc <<< "$version >= $compare_version"` )); then + rm -rf /etc/apache2/conf.d/xcat.conf + cp /etc/xcat/conf.orig/xcat.conf.apach24 /etc/apache2/conf.d/xcat.conf + fi fi