2009-06-24 23:46:34 +00:00
|
|
|
Summary: Web Client for xCAT 2
|
|
|
|
Name: xCAT-UI
|
|
|
|
Version: %(cat Version)
|
|
|
|
Release: snap%(date +"%Y%m%d%H%M")
|
|
|
|
Epoch: 4
|
|
|
|
|
|
|
|
License: EPL
|
|
|
|
Group: Applications/System
|
2009-06-29 18:59:31 +00:00
|
|
|
Source: xCAT-UI-%(cat Version).tar.gz
|
2009-06-24 23:46:34 +00:00
|
|
|
Packager: IBM Corp.
|
|
|
|
Vendor: IBM Corp.
|
|
|
|
URL: http://xcat.org
|
|
|
|
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
|
|
|
|
Prefix: /opt/xcat
|
|
|
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
|
|
|
|
|
|
|
|
BuildArch: noarch
|
2009-06-29 18:59:31 +00:00
|
|
|
Provides: xCAT-UI = %{version}
|
2009-06-24 23:46:34 +00:00
|
|
|
|
|
|
|
%ifos linux
|
|
|
|
# httpd is provided by apache2 on SLES and httpd on RHEL
|
2009-12-15 06:32:32 +00:00
|
|
|
Requires: httpd
|
2009-06-24 23:46:34 +00:00
|
|
|
# we also require php4-session on SLES, but this does not exist on RHEL, so do not know how to do the Require
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%description
|
|
|
|
Provides a browser-based interface for xCAT (extreme Cluster Administration Tool).
|
|
|
|
|
|
|
|
%prep
|
2009-06-29 18:59:31 +00:00
|
|
|
%setup -q -n xCAT-UI
|
2009-06-24 23:46:34 +00:00
|
|
|
%build
|
|
|
|
%install
|
|
|
|
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
2009-06-29 18:59:31 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT%{prefix}/ui
|
2009-06-24 23:46:34 +00:00
|
|
|
|
2009-10-08 22:26:16 +00:00
|
|
|
set +x
|
2009-06-29 18:59:31 +00:00
|
|
|
cp -r * $RPM_BUILD_ROOT%{prefix}/ui
|
|
|
|
chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/*
|
2010-09-20 18:25:09 +00:00
|
|
|
chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/lib/ajaxterm/*.py
|
2009-10-08 22:26:16 +00:00
|
|
|
set -x
|
2009-06-24 23:46:34 +00:00
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
2009-06-29 18:59:31 +00:00
|
|
|
%{prefix}/ui
|
2009-06-24 23:46:34 +00:00
|
|
|
|
2009-12-15 06:32:32 +00:00
|
|
|
%pre
|
|
|
|
# the %pre part is used to inspect whether the php-related rpm packages are installed into linux or not
|
|
|
|
# if they're not installed, the installation of "xCAT-UI" will be failed.
|
|
|
|
%ifos linux
|
|
|
|
if [ -e "/etc/redhat-release" ]; then
|
|
|
|
rpm -q php >/dev/null
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo ""
|
2009-12-15 07:42:47 +00:00
|
|
|
echo "Error! php has not been installed yet;please run 'yum install php' before installing xCAT-UI";
|
2009-12-15 06:32:32 +00:00
|
|
|
exit -1;
|
|
|
|
fi
|
|
|
|
else #SUSE
|
|
|
|
rpm -q apache2-mod_php5 php5 >/dev/null
|
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo ""
|
2009-12-15 07:42:47 +00:00
|
|
|
echo "Error! apache2-mod_php5 and php5 have not been installed yet; please run 'zypper install apache2-mod_php5 php5'before installing xCAT-UI"
|
2009-12-15 06:32:32 +00:00
|
|
|
exit -1;
|
|
|
|
fi
|
|
|
|
fi
|
2009-12-22 03:14:23 +00:00
|
|
|
|
|
|
|
%else #on AIX
|
|
|
|
if [ -e "/usr/IBM/HTTPServer/conf/httpd.conf" ]; then
|
|
|
|
echo "Installing xCAT-UI on AIX..."
|
|
|
|
else
|
|
|
|
echo ""
|
|
|
|
echo "Error!"
|
|
|
|
echo "The IBM HTTP Server is not installed or not installed into the default directory(/usr/IBM/HTTPServer/)"
|
|
|
|
exit -1;
|
|
|
|
fi
|
|
|
|
|
2009-12-15 06:32:32 +00:00
|
|
|
%endif
|
2009-06-24 23:46:34 +00:00
|
|
|
|
|
|
|
%post
|
|
|
|
# Post-install script---------------------------------------------------
|
|
|
|
%ifos linux
|
|
|
|
# Set variables for apache because the names vary on redhat and suse
|
|
|
|
if [ -e "/etc/redhat-release" ]; then
|
|
|
|
apachedaemon='httpd'
|
|
|
|
apacheuser='apache'
|
|
|
|
else # SuSE
|
2009-12-15 06:32:32 +00:00
|
|
|
|
2009-06-24 23:46:34 +00:00
|
|
|
apachedaemon='apache2'
|
|
|
|
apacheuser='wwwrun'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = 1 ] # initial install
|
|
|
|
then
|
|
|
|
# Update the apache config
|
2009-06-29 18:59:31 +00:00
|
|
|
/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
|
2009-06-24 23:46:34 +00:00
|
|
|
/etc/init.d/$apachedaemon reload
|
2009-12-15 06:32:32 +00:00
|
|
|
# automatically put the encrypted passwd into the xcat passwd db
|
|
|
|
%{prefix}/sbin/chtab key=xcat,username=root passwd.password=`grep root /etc/shadow|cut -d : -f 2`
|
2009-06-24 23:46:34 +00:00
|
|
|
|
2010-08-19 20:00:55 +00:00
|
|
|
echo "To use xCAT-UI, point your browser to http://"`hostname -f`"/xcat"
|
2009-06-24 23:46:34 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = 1 ] || [ "$1" = 2 ] # initial install, or upgrade and this is the newer rpm
|
|
|
|
then
|
2009-06-29 18:59:31 +00:00
|
|
|
# Uncomment this if we change xcat-ui.conf again
|
2009-06-24 23:46:34 +00:00
|
|
|
#/etc/init.d/$apachedaemon reload
|
|
|
|
true
|
|
|
|
fi
|
|
|
|
|
|
|
|
%else #on AIX, it's different
|
|
|
|
ihs_config_dir='/usr/IBM/HTTPServer/conf'
|
|
|
|
if [ "$1" = 1 ] #initial install
|
|
|
|
then
|
2009-12-22 02:36:00 +00:00
|
|
|
# check if IBM HTTP Server is installed into the default directory or not
|
2009-12-22 03:14:23 +00:00
|
|
|
# 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
|
2009-12-15 06:32:32 +00:00
|
|
|
|
|
|
|
# put the encrypted password in /etc/security/passwd to the xcat passwd db
|
|
|
|
CONT=`cat /etc/security/passwd`
|
|
|
|
%{prefix}/sbin/chtab key=xcat,username=root passwd.password=`echo $CONT |cut -d ' ' -f 4`
|
2009-06-24 23:46:34 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = 1 ] || [ "$1" = 2 ] # initial install, or upgrade and this is the newer rpm
|
|
|
|
then
|
2009-06-29 18:59:31 +00:00
|
|
|
# Uncomment this if we change xcat-ui.conf again
|
2009-06-24 23:46:34 +00:00
|
|
|
#/etc/init.d/$apachedaemon reload
|
|
|
|
true
|
|
|
|
fi
|
|
|
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%preun
|
|
|
|
# Pre-uninstall script -------------------------------------------------
|
|
|
|
|
|
|
|
%ifos linux
|
|
|
|
if [ "$1" = 0 ] # final 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..."
|
2009-06-29 18:59:31 +00:00
|
|
|
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf
|
2009-06-24 23:46:34 +00:00
|
|
|
/etc/init.d/$apachedaemon reload
|
|
|
|
fi
|
|
|
|
%else #for AIX
|
|
|
|
# Remove links made during the post install script
|
|
|
|
echo "Undoing IBM HTTP Server configuration for xCAT..."
|
2009-12-22 03:14:23 +00:00
|
|
|
if [ -e "/usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak" ];then
|
2009-12-22 02:36:00 +00:00
|
|
|
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
|
2009-06-24 23:46:34 +00:00
|
|
|
/usr/IBM/HTTPServer/bin/apachectl restart
|
|
|
|
%endif
|
|
|
|
|