Turn off output_buffering in Apache Web Server in order to flush output to browser.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@9299 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
phamt 2011-04-13 14:13:20 +00:00
parent 1175706f14
commit 1fd0952983
2 changed files with 101 additions and 94 deletions

View File

@ -1,4 +1,5 @@
Alias /xcat "/opt/xcat/ui"
PHPINIDir "/opt/xcat/ui"
<Directory "/opt/xcat/ui">
Options FollowSymLinks
AllowOverride None

View File

@ -29,18 +29,19 @@ Provides a browser-based interface for xCAT (Extreme Cloud Administration Toolki
%setup -q -n xCAT-UI
%build
#********** Build **********
# Minify Javascript files using Google Compiler
echo "Minifying Javascripts... This will take a couple of minutes."
COMPILER_JAR='/xcat2/build/tools/compiler.jar'
UI_JS="js/"
# Find all Javascript files
declare -a FILES
FILES=`find ${UI_JS} -name '*.js'`
%ifos linux
JAVA='/opt/ibm/java-ppc64-60/jre/bin/java'
declare -a FILES
# Find all Javascript files
FILES=`find ${UI_JS} -name '*.js'`
for i in ${FILES[*]}; do
# Ignore Javascripts that are already minified
if [[ ! $i =~ '.*\.min\.js$' ]]; then
@ -51,9 +52,9 @@ for i in ${FILES[*]}; do
mv $i.min $i
fi
done
%else #AIX
%else # AIX
JAVA='/usr/java6_64/bin/java'
FILES=`find ${UI_JS} -name '*.js'`
for i in ${FILES[*]}; do
# Ignore Javascripts that are already minified
if [[ ! $i = @(*.min.js) ]]; then
@ -66,11 +67,11 @@ for i in ${FILES[*]}; do
done
%endif
IFS='
'
%install
#********** Install **********
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{prefix}/ui
set +x
@ -83,25 +84,24 @@ set -x
%{prefix}/ui
%pre
#---------- Pre-install ----------
#********** Pre-install **********
# Inspect whether PHP related RPM packages are installed
%ifos linux
if [ -e "/etc/redhat-release" ]; then
rpm -q php >/dev/null
if [ $? != 0 ]; then
echo ""
echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI.";
exit -1;
if [ -e "/etc/redhat-release" ]; then
rpm -q php >/dev/null
if [ $? != 0 ]; then
echo ""
echo "Error! php has not been installed. Please run 'yum install php' before installing xCAT-UI.";
exit -1;
fi
else # SUSE
rpm -q apache2-mod_php5 php5 >/dev/null
if [ $? != 0 ]; then
echo ""
echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI."
exit -1;
fi
fi
else # SuSE
rpm -q apache2-mod_php5 php5 >/dev/null
if [ $? != 0 ]; then
echo ""
echo "Error! apache2-mod_php5 and php5 have not been installed. Please run 'zypper install apache2-mod_php5 php5' before installing xCAT-UI."
exit -1;
fi
fi
%else # AIX
if [ -e "/usr/IBM/HTTPServer/conf/httpd.conf" ]; then
echo "Installing xCAT-UI on AIX..."
@ -110,89 +110,95 @@ fi
echo "Error! IBM HTTP Server is not installed or not installed in the default directory (/usr/IBM/HTTPServer/)."
exit -1;
fi
%endif
%post
#---------- Post-install ----------
#********** Post-install **********
# Get apache name
%ifos linux
if [ -e "/etc/redhat-release" ]; then
apachedaemon='httpd'
apacheuser='apache'
else # SuSE
apachedaemon='apache2'
apacheuser='wwwrun'
fi
if [ "$1" = 1 ] # Install
then
# Update apache conf
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf
/bin/ln -s %{prefix}/ui/etc/apache2/conf.d/xcat-ui.conf /etc/$apachedaemon/conf.d/xcat-ui.conf
/etc/init.d/$apachedaemon reload
# Automatically put encrypted password into the xCAT passwd database
%{prefix}/sbin/chtab key=xcat,username=root passwd.password=`grep root /etc/shadow|cut -d : -f 2`
echo "To use xCAT-UI, point your browser to http://"`hostname -f`"/xcat"
fi
if [ "$1" = 1 ] || [ "$1" = 2 ] # Install or upgrade
then
# Uncomment this if we change xcat-ui.conf again
# /etc/init.d/$apachedaemon reload
true
fi
if [ -e "/etc/redhat-release" ]; then
apachedaemon='httpd'
apacheuser='apache'
else # SUSE
apachedaemon='apache2'
apacheuser='wwwrun'
fi
if [ "$1" = 1 ] # Install
then
# Update apache conf
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf
/bin/ln -s %{prefix}/ui/etc/apache2/conf.d/xcat-ui.conf /etc/$apachedaemon/conf.d/xcat-ui.conf
/etc/init.d/$apachedaemon reload
# Copy php.ini file into /opt/xcat/ui and turn off output_buffering
if [ -e "/etc/redhat-release" ]; then
sed /etc/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini
else # SUSE
sed /etc/php5/apache2/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini
fi
# Automatically put encrypted password into the xCAT passwd database
%{prefix}/sbin/chtab key=xcat,username=root passwd.password=`grep root /etc/shadow|cut -d : -f 2`
echo "To use xCAT-UI, point your browser to http://"`hostname -f`"/xcat"
fi
if [ "$1" = 1 ] || [ "$1" = 2 ] # Install or upgrade
then
# Uncomment this if we change xcat-ui.conf again
# /etc/init.d/$apachedaemon reload
true
fi
%else # AIX
ihs_config_dir='/usr/IBM/HTTPServer/conf'
if [ "$1" = 1 ] #initial install
then
# Check if IBM HTTP Server is installed in the default directory
# Update the apache config
echo "Updating IBM HTTP server configuration for xCAT..."
bin/rm -f /usr/IBM/HTTPServer/conf/xcat-ui.conf
cp /usr/IBM/HTTPServer/conf/httpd.conf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak
cat /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf >> /usr/IBM/HTTPServer/conf/httpd.conf
/usr/IBM/HTTPServer/bin/apachectl restart
ihs_config_dir='/usr/IBM/HTTPServer/conf'
if [ "$1" = 1 ] #initial install
then
# Check if IBM HTTP Server is installed in the default directory
# Update the apache config
echo "Updating IBM HTTP server configuration for xCAT..."
bin/rm -f /usr/IBM/HTTPServer/conf/xcat-ui.conf
cp /usr/IBM/HTTPServer/conf/httpd.conf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak
cat /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf >> /usr/IBM/HTTPServer/conf/httpd.conf
/usr/IBM/HTTPServer/bin/apachectl restart
# Put the encrypted password in /etc/security/passwd into the xcat passwd database
CONT=`cat /etc/security/passwd`
%{prefix}/sbin/chtab key=xcat,username=root passwd.password=`echo $CONT |cut -d ' ' -f 4`
fi
# Put the encrypted password in /etc/security/passwd into the xcat passwd database
CONT=`cat /etc/security/passwd`
%{prefix}/sbin/chtab key=xcat,username=root passwd.password=`echo $CONT |cut -d ' ' -f 4`
fi
if [ "$1" = 1 ] || [ "$1" = 2 ] # Install or upgrade
then
# Uncomment this if we change xcat-ui.conf again
# /etc/init.d/$apachedaemon reload
true
fi
if [ "$1" = 1 ] || [ "$1" = 2 ] # Install or upgrade
then
# Uncomment this if we change xcat-ui.conf again
# /etc/init.d/$apachedaemon reload
true
fi
%endif
%preun
#---------- Pre-uninstall ----------
%ifos linux
if [ "$1" = 0 ] # RPM being removed
then
if [ -e "/etc/redhat-release" ]; then
apachedaemon='httpd'
apacheuser='apache'
else # SuSE
apachedaemon='apache2'
apacheuser='wwwrun'
fi
# Remove links made during the post install script
echo "Undoing $apachedaemon configuration for xCAT..."
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf
/etc/init.d/$apachedaemon reload
fi
if [ "$1" = 0 ] # RPM being removed
then
if [ -e "/etc/redhat-release" ]; then
apachedaemon='httpd'
apacheuser='apache'
else # SUSE
apachedaemon='apache2'
apacheuser='wwwrun'
fi
# Remove links made during the post install script
echo "Undoing $apachedaemon configuration for xCAT..."
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf
/etc/init.d/$apachedaemon reload
fi
%else # AIX
# Remove links made during the post install script
echo "Undoing IBM HTTP Server configuration for xCAT..."
if [ -e "/usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak" ];then
cp /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak /usr/IBM/HTTPServer/conf/httpd.conf
rm -rf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak
fi
/usr/IBM/HTTPServer/bin/apachectl restart
# Remove links made during the post install script
echo "Undoing IBM HTTP Server configuration for xCAT..."
if [ -e "/usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak" ];then
cp /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak /usr/IBM/HTTPServer/conf/httpd.conf
rm -rf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak
fi
/usr/IBM/HTTPServer/bin/apachectl restart
%endif