2007-12-18 15:30:44 +00:00
|
|
|
Summary: Web Interface for xCAT
|
|
|
|
Name: xCAT-web
|
2008-06-02 13:02:07 +00:00
|
|
|
Version: 2.1
|
2007-12-18 15:30:44 +00:00
|
|
|
Release: snap%(date +"%Y%m%d%H%M")
|
2008-06-26 18:42:36 +00:00
|
|
|
Epoch: 4
|
2007-12-18 15:30:44 +00:00
|
|
|
|
|
|
|
License: EPL
|
|
|
|
Group: Applications/System
|
2008-06-03 14:54:43 +00:00
|
|
|
Source: xCAT-web-2.1.tar.gz
|
2007-12-18 15:30:44 +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
|
|
|
|
Provides: xCAT-web = %{version}
|
|
|
|
|
|
|
|
# httpd is provided by apache2 on SLES and httpd on RHEL
|
|
|
|
Requires: httpd
|
|
|
|
# we also require php4-session on SLES, but this does not exist on RHEL, so do not know how to do the Require
|
|
|
|
|
|
|
|
%description
|
|
|
|
Provides a browser-based interface for xCAT (extreme Cluster Administration Tool).
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q
|
|
|
|
%build
|
|
|
|
%install
|
|
|
|
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
|
|
|
|
mkdir -p $RPM_BUILD_ROOT%{prefix}/web
|
|
|
|
|
|
|
|
cp -r * $RPM_BUILD_ROOT%{prefix}/web
|
|
|
|
chmod 755 $RPM_BUILD_ROOT%{prefix}/web/*
|
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root)
|
|
|
|
# %defattr( 555, root, root, 755 )
|
2008-01-17 20:33:12 +00:00
|
|
|
%{prefix}/web
|
2007-12-18 15:30:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
%post
|
|
|
|
# Post-install script---------------------------------------------------
|
|
|
|
|
|
|
|
if [ "$1" = 1 ] # initial install
|
|
|
|
then
|
|
|
|
# Set variables for apache because the names vary on redhat and suse
|
|
|
|
if [ -e "/etc/redhat-release" ]; then
|
|
|
|
apachedaemon='httpd'
|
|
|
|
apacheuser='apache'
|
2008-01-17 20:33:12 +00:00
|
|
|
|
2008-09-26 20:25:53 +00:00
|
|
|
# Note: this was for sudo with xcat 1.3
|
|
|
|
#echo "Updating apache userid to allow logins..."
|
|
|
|
#cp /etc/passwd /etc/passwd.orig
|
|
|
|
#perl -e 'while (<>) { s,^apache:(.*):/sbin/nologin$,apache:$1:/bin/bash,; print $_; }' /etc/passwd.orig >/etc/passwd
|
2008-01-17 20:33:12 +00:00
|
|
|
else # SuSE
|
2007-12-18 15:30:44 +00:00
|
|
|
apachedaemon='apache2'
|
|
|
|
apacheuser='wwwrun'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Update the apache config
|
2008-01-17 20:33:12 +00:00
|
|
|
echo "Updating $apachedaemon configuration for xCAT..."
|
2008-02-08 21:53:41 +00:00
|
|
|
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-web.conf
|
|
|
|
/bin/ln -s %{prefix}/web/etc/apache2/conf.d/xcat-web.conf /etc/$apachedaemon/conf.d/xcat-web.conf
|
2007-12-18 15:30:44 +00:00
|
|
|
/etc/init.d/$apachedaemon reload
|
|
|
|
|
2008-09-26 20:25:53 +00:00
|
|
|
# Link to the grpattr cmd. Note: this was for xcat 1.3. Do not use this anymore.
|
|
|
|
#/bin/rm -f %{prefix}/bin/grpattr
|
|
|
|
#mkdir -p %{prefix}/bin
|
|
|
|
#/bin/ln -s %{prefix}/web/cmds/grpattr %{prefix}/bin/grpattr
|
|
|
|
|
|
|
|
# Config sudo. Note: this was for xcat 1.3. Do not use this anymore.
|
|
|
|
#if ! egrep -q "^$apacheuser ALL=\(ALL\) NOPASSWD:ALL" /etc/sudoers; then
|
|
|
|
#echo "Configuring sudo for $apacheuser..."
|
|
|
|
#echo "$apacheuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
|
|
#fi
|
2008-01-17 20:33:12 +00:00
|
|
|
|
2008-02-08 21:53:41 +00:00
|
|
|
# Authorize the apacheuser to xcatd
|
2008-09-26 20:25:53 +00:00
|
|
|
echo -e "y\ny\ny" | %{prefix}/share/xcat/scripts/setup-local-client.sh $apacheuser
|
|
|
|
XCATROOT=%{prefix} %{prefix}/sbin/chtab priority=5 policy.name=$apacheuser policy.rule=allow
|
2008-02-08 21:53:41 +00:00
|
|
|
|
2007-12-18 15:30:44 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = 1 ] || [ "$1" = 2 ] # initial install, or upgrade and this is the newer rpm
|
|
|
|
then
|
|
|
|
true
|
|
|
|
fi
|
|
|
|
|
|
|
|
%preun
|
|
|
|
# Pre-uninstall script -------------------------------------------------
|
|
|
|
|
|
|
|
if [ "$1" = 0 ] # final rpm being removed
|
|
|
|
then
|
|
|
|
if [ -e "/etc/redhat-release" ]; then
|
2008-01-17 20:33:12 +00:00
|
|
|
apachedaemon='httpd'
|
|
|
|
apacheuser='apache'
|
|
|
|
|
|
|
|
# Undo change we made to passwd file. Todo: change this when switch to xcat 2
|
2008-09-26 20:25:53 +00:00
|
|
|
#echo "Undoing apache userid login..."
|
|
|
|
#cp /etc/passwd /etc/passwd.tmp
|
|
|
|
#perl -e 'while (<>) { s,^apache:(.*):/bin/bash$,apache:$1:/sbin/nologin,; print $_; }' /etc/passwd.tmp >/etc/passwd
|
2008-01-17 20:33:12 +00:00
|
|
|
else # SuSE
|
|
|
|
apachedaemon='apache2'
|
|
|
|
apacheuser='wwwrun'
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove links made during the post install script
|
|
|
|
echo "Undoing $apachedaemon configuration for xCAT..."
|
2008-02-08 21:53:41 +00:00
|
|
|
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-web.conf
|
2008-01-17 20:33:12 +00:00
|
|
|
/etc/init.d/$apachedaemon reload
|
2008-09-26 20:25:53 +00:00
|
|
|
#/bin/rm -f %{prefix}/bin/grpattr
|
2008-01-17 20:33:12 +00:00
|
|
|
|
|
|
|
# Remove change we made to sudoers config. Todo: remove this when switch to xcat 2
|
2008-09-26 20:25:53 +00:00
|
|
|
#if egrep -q "^$apacheuser ALL=\(ALL\) NOPASSWD:ALL" /etc/sudoers; then
|
|
|
|
#echo "Undoing sudo configuration for $apacheuser..."
|
|
|
|
#cp -f /etc/sudoers /etc/sudoers.tmp
|
|
|
|
#egrep -v "^$apacheuser ALL=\(ALL\) NOPASSWD:ALL" /etc/sudoers.tmp > /etc/sudoers
|
|
|
|
#rm -f /etc/sudoers.tmp
|
|
|
|
#fi
|
2008-01-17 20:33:12 +00:00
|
|
|
|
2007-12-18 15:30:44 +00:00
|
|
|
fi
|
|
|
|
|