add conf support for apache2.4

This commit is contained in:
immarvin 2014-10-31 02:43:22 -07:00
parent ec1ef81ea8
commit 9ba2726f83
3 changed files with 40 additions and 19 deletions

View File

@ -328,6 +328,8 @@ chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-server/*
mkdir -p $RPM_BUILD_ROOT/%{prefix}/ws
mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d
mkdir -p $RPM_BUILD_ROOT/etc/xcat/conf.orig
cp xCAT-wsapi/* $RPM_BUILD_ROOT/%{prefix}/ws
# PCM does not need xcatws.cgi
@ -338,20 +340,24 @@ rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcatws.cgi
%if %fsm
%else
echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22
echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache24
%if %notpcm
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache24
%endif
cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache2 >> $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
%if %notpcm
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache22 >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22
cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache24 >> $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache24
#install lower version(<2.4) apache/httpd conf files by default
cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
cp $RPM_BUILD_ROOT/etc/xcat/conf.orig/xcat-ws.conf.apache22 $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
%endif
cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.httpd >> $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
%endif
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache2
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.httpd
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache22
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf.apache24
%clean
rm -rf $RPM_BUILD_ROOT
@ -364,6 +370,8 @@ rm -rf $RPM_BUILD_ROOT
%if %fsm
%else
/etc/init.d/xcatd
#/etc/xcat/conf.orig/xcat-ws.conf.apache24
#/etc/xcat/conf.orig/xcat-ws.conf.apache22
/etc/apache2/conf.d/xcat-ws.conf
/etc/httpd/conf.d/xcat-ws.conf
%endif
@ -409,8 +417,8 @@ fi
if [ "$1" -gt "1" ]; then #only on upgrade...
#migration issue for monitoring
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab filename=monitorctrl.pm notification -d
fi
%else
if [ "$1" -gt "1" ]; then #only on upgrade for AIX...
#migration issue for monitoring
@ -420,6 +428,26 @@ fi
%endif
#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-ws.conf
cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/httpd/conf.d/xcat-ws.conf
fi
if [ -n "$(apachectl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
then
rm -rf /etc/apache2/conf.d/xcat-ws.conf
cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/apache2/conf.d/xcat-ws.conf
fi
if [ -n "$(apache2ctl -v 2>&1 |grep -e '^Server version\s*:.*\/2.4')" ]
then
rm -rf /etc/apache2/conf.d/xcat-ws.conf
cp /etc/xcat/conf.orig/xcat-ws.conf.apache24 /etc/apache2/conf.d/xcat-ws.conf
fi
exit 0
%preun
@ -435,8 +463,6 @@ if [ $1 == 0 ]; then #This means only on -e
fi
rm -f /usr/sbin/xcatd #remove the symbolic
rm -f /etc/httpd/conf.d/xcat-ws.conf
rm -f /etc/httpd/conf.d/xcat-ws.conf
fi
%endif

View File

@ -5,7 +5,6 @@ RewriteCond %{REQUEST_URI} xcatws
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [R,L]
<Files xcatws.cgi>
Order allow,deny
Allow from all
Require all granted
</Files>

View File

@ -1,4 +0,0 @@
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} xcatws
RewriteRule ^(.*)$ https://%{SERVER_NAME}$1 [R,L]