2007-10-26 22:44:33 +00:00
|
|
|
Summary: Metapackage for a common, default xCAT setup
|
|
|
|
Name: xCAT
|
2008-11-20 17:08:23 +00:00
|
|
|
Version: 2.1.1
|
2007-10-26 22:44:33 +00:00
|
|
|
Release: snap%(date +"%Y%m%d%H%M")
|
|
|
|
License: EPL
|
|
|
|
Group: Applications/System
|
|
|
|
Vendor: IBM Corp.
|
|
|
|
Packager: IBM Corp.
|
|
|
|
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
|
2007-12-13 22:12:47 +00:00
|
|
|
Prefix: /opt/xcat
|
2007-10-26 22:44:33 +00:00
|
|
|
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
|
2008-01-17 18:23:31 +00:00
|
|
|
#BuildArch: noarch
|
2007-10-26 22:44:33 +00:00
|
|
|
Source1: xcat.conf
|
|
|
|
Source2: postscripts.tar.gz
|
|
|
|
Source3: templates.tar.gz
|
|
|
|
|
|
|
|
Provides: xCAT = %{version}
|
2008-04-05 14:53:35 +00:00
|
|
|
Requires: xCAT-server xCAT-client perl-DBD-SQLite
|
2008-01-23 18:00:13 +00:00
|
|
|
|
2008-01-17 18:23:31 +00:00
|
|
|
%ifos linux
|
2008-04-30 17:54:13 +00:00
|
|
|
Requires: atftp dhcp httpd nfs-utils expect conserver fping bind perl-XML-Parser vsftpd
|
2008-01-17 18:23:31 +00:00
|
|
|
%endif
|
2008-01-23 18:00:13 +00:00
|
|
|
|
2008-01-17 18:23:31 +00:00
|
|
|
%ifarch i386 i586 i686 x86 x86_64
|
2008-04-25 14:03:55 +00:00
|
|
|
Requires: xCAT-nbroot-oss-x86 xCAT-nbroot-core-x86 xCAT-nbkernel-x86 xCAT-nbroot-oss-x86_64 xCAT-nbroot-core-x86_64 xCAT-nbkernel-x86_64 syslinux
|
2007-10-26 22:44:33 +00:00
|
|
|
Requires: ipmitool >= 1.8.9
|
2008-01-17 18:23:31 +00:00
|
|
|
%endif
|
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
%description
|
|
|
|
xCAT is a server management package intended for at-scale management, including
|
|
|
|
hardware management and software management.
|
|
|
|
|
|
|
|
%prep
|
2008-01-23 18:00:13 +00:00
|
|
|
%ifos linux
|
2008-04-05 14:53:35 +00:00
|
|
|
tar zxf %{SOURCE2}
|
2008-01-23 18:00:13 +00:00
|
|
|
%else
|
|
|
|
rm -rf postscripts
|
|
|
|
cp %{SOURCE2} /opt/freeware/src/packages/BUILD
|
2008-04-05 14:53:35 +00:00
|
|
|
gunzip -f postscripts.tar.gz
|
|
|
|
tar -xf postscripts.tar
|
2008-01-23 18:00:13 +00:00
|
|
|
%endif
|
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
%build
|
2008-01-23 18:00:13 +00:00
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
%install
|
2008-07-07 21:14:14 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d
|
2007-10-26 22:44:33 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/install/postscripts
|
2007-12-13 22:12:47 +00:00
|
|
|
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/
|
|
|
|
cd $RPM_BUILD_ROOT/%{prefix}/share/xcat/
|
2008-01-23 18:00:13 +00:00
|
|
|
|
|
|
|
%ifos linux
|
2008-04-05 14:53:35 +00:00
|
|
|
tar zxf %{SOURCE3}
|
2008-01-23 18:00:13 +00:00
|
|
|
%else
|
|
|
|
cp %{SOURCE3} $RPM_BUILD_ROOT/%{prefix}/share/xcat
|
2008-04-05 14:53:35 +00:00
|
|
|
gunzip -f templates.tar.gz
|
|
|
|
tar -xf templates.tar
|
2008-01-23 18:00:13 +00:00
|
|
|
rm templates.tar
|
|
|
|
%endif
|
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
cd -
|
|
|
|
cd $RPM_BUILD_ROOT/install
|
2008-01-23 18:00:13 +00:00
|
|
|
|
|
|
|
%ifos linux
|
2008-04-05 14:53:35 +00:00
|
|
|
tar zxf %{SOURCE2}
|
2008-01-23 18:00:13 +00:00
|
|
|
%else
|
|
|
|
cp %{SOURCE2} $RPM_BUILD_ROOT/install
|
2008-04-05 14:53:35 +00:00
|
|
|
gunzip -f postscripts.tar.gz
|
|
|
|
tar -xf postscripts.tar
|
2008-01-23 18:00:13 +00:00
|
|
|
rm postscripts.tar
|
|
|
|
%endif
|
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
rm LICENSE.html
|
|
|
|
mkdir -p postscripts/hostkeys
|
|
|
|
cd -
|
2008-07-07 21:14:14 +00:00
|
|
|
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat.conf
|
2007-10-26 22:44:33 +00:00
|
|
|
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf
|
2007-12-13 22:12:47 +00:00
|
|
|
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
|
|
|
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
|
|
|
|
|
2007-10-26 22:44:33 +00:00
|
|
|
%post
|
2008-01-23 18:00:13 +00:00
|
|
|
%ifnos linux
|
2008-03-04 14:15:38 +00:00
|
|
|
. /etc/profile
|
2008-01-23 18:00:13 +00:00
|
|
|
$RPM_INSTALL_PREFIX0/sbin/xcatconfig
|
|
|
|
%else
|
2008-03-04 14:15:38 +00:00
|
|
|
. /etc/profile.d/xcat.sh
|
|
|
|
|
2008-07-09 14:10:24 +00:00
|
|
|
# ugly hack so we can have 1 RPM support both sles and rhel
|
|
|
|
if [ -e /etc/SuSE-release ]; then
|
2008-07-07 21:14:14 +00:00
|
|
|
apachename=apache2
|
|
|
|
else
|
2008-07-09 14:10:24 +00:00
|
|
|
apachename=httpd
|
2008-07-07 21:14:14 +00:00
|
|
|
fi
|
|
|
|
|
2008-04-30 17:54:13 +00:00
|
|
|
if [ ! -d /var/ftp/install ]; then
|
|
|
|
mkdir -p /var/ftp/install
|
|
|
|
echo "/install /var/ftp/install none bind,defaults 0 0" >> /etc/fstab
|
|
|
|
mount /var/ftp/install
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -d /var/ftp/tftpboot ]; then
|
|
|
|
mkdir -p /var/ftp/tftpboot
|
|
|
|
echo "/tftpboot /var/ftp/tftpboot none bind,defaults 0 0" >> /etc/fstab
|
|
|
|
mount /var/ftp/tftpboot
|
|
|
|
fi
|
|
|
|
|
2008-04-05 14:53:35 +00:00
|
|
|
if [ ! -f /install/postscripts/hostkeys/ssh_host_key ]; then
|
2007-10-26 22:44:33 +00:00
|
|
|
echo Generating SSH1 RSA Key...
|
|
|
|
/usr/bin/ssh-keygen -t rsa1 -f /install/postscripts/hostkeys/ssh_host_key -C '' -N ''
|
|
|
|
echo Generating SSH2 RSA Key...
|
|
|
|
/usr/bin/ssh-keygen -t rsa -f /install/postscripts/hostkeys/ssh_host_rsa_key -C '' -N ''
|
|
|
|
echo Generating SSH2 DSA Key...
|
|
|
|
/usr/bin/ssh-keygen -t dsa -f /install/postscripts/hostkeys/ssh_host_dsa_key -C '' -N ''
|
|
|
|
fi
|
2008-04-30 20:54:57 +00:00
|
|
|
if [ -d /install/postscripts/.ssh ]; then
|
|
|
|
mv /install/postscripts/.ssh /install/postscripts/_ssh
|
|
|
|
fi
|
|
|
|
if [ -d /install/postscripts/.xcat ]; then
|
|
|
|
mv /install/postscripts/.xcat /install/postscripts/_xcat
|
|
|
|
fi
|
2008-05-02 18:39:17 +00:00
|
|
|
chkconfig vsftpd on
|
2008-10-17 17:59:57 +00:00
|
|
|
/etc/init.d/vsftpd start
|
2008-11-20 17:43:54 +00:00
|
|
|
# remove any service node file
|
2008-11-21 13:12:21 +00:00
|
|
|
if [ -f /etc/xCATSN ]; then
|
2008-11-20 17:43:54 +00:00
|
|
|
rm /etc/xCATSN
|
2008-11-21 13:12:21 +00:00
|
|
|
fi
|
2008-11-20 17:43:54 +00:00
|
|
|
if [ "$1" = "1" ]; then #Only if installing for the first time..
|
2007-10-26 22:44:33 +00:00
|
|
|
mkdir -p /root/.ssh
|
|
|
|
chmod 700 /root/.ssh
|
|
|
|
echo StrictHostKeyChecking no >> /root/.ssh/config
|
|
|
|
chmod 600 /root/.ssh/config
|
|
|
|
if [ ! -r /root/.ssh/id_rsa.pub ]; then
|
|
|
|
ssh-keygen -t rsa -q -b 2048 -N "" -f /root/.ssh/id_rsa
|
|
|
|
fi
|
2008-04-30 20:54:57 +00:00
|
|
|
mkdir -p /install/postscripts/_ssh
|
|
|
|
cp /root/.ssh/id_rsa.pub /install/postscripts/_ssh/authorized_keys
|
2008-07-17 13:44:56 +00:00
|
|
|
chmod 644 /install/postscripts/_ssh/authorized_keys
|
2007-10-26 22:44:33 +00:00
|
|
|
|
|
|
|
mkdir -p /var/log/consoles
|
2008-01-16 21:14:50 +00:00
|
|
|
if ! grep /tftpboot /etc/exports; then
|
2008-03-04 19:34:52 +00:00
|
|
|
echo '/tftpboot *(rw,no_root_squash,sync)' >> /etc/exports #SECURITY: this has potential for sharing private host/user keys
|
2008-01-16 21:14:50 +00:00
|
|
|
fi
|
2007-10-26 22:44:33 +00:00
|
|
|
if ! grep /install /etc/exports; then
|
2008-03-04 15:03:44 +00:00
|
|
|
echo '/install *(rw,no_root_squash,sync)' >> /etc/exports #SECURITY: this has potential for sharing private host/user keys
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
2008-02-21 16:36:58 +00:00
|
|
|
chkconfig nfs on
|
2008-10-17 17:59:57 +00:00
|
|
|
/etc/init.d/nfs stop
|
|
|
|
/etc/init.d/nfs start
|
2008-02-21 16:36:58 +00:00
|
|
|
exportfs -a
|
2008-04-05 14:53:35 +00:00
|
|
|
if [ ! -r /etc/xcat/site.sqlite ]; then
|
2007-12-13 22:12:47 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=xcatdport site.value=3001
|
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=xcatiport site.value=3002
|
2008-03-18 15:27:59 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=tftpdir site.value=/tftpboot
|
2007-12-13 22:12:47 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=master site.value=$(getent hosts `hostname`|awk '{print $1}')
|
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=domain site.value=$(hostname -d)
|
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=installdir site.value=/install
|
2008-07-07 21:14:14 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=timezone site.value=`grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
2008-04-14 12:11:49 +00:00
|
|
|
if [ ! -r /etc/xcat/postscripts.sqlite ]; then
|
2008-09-11 22:03:01 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab node=xcatdefaults postscripts.postscripts='syslog,remoteshell'
|
2008-04-15 11:56:19 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab node=service postscripts.postscripts='servicenode'
|
2008-04-14 12:11:49 +00:00
|
|
|
fi
|
2008-04-05 14:53:35 +00:00
|
|
|
if [ ! -r /etc/xcat/policy.sqlite ]; then
|
2007-12-13 22:12:47 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=1 policy.name=root policy.rule=allow
|
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=2 policy.commands=getbmcconfig policy.rule=allow
|
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=3 policy.commands=nextdestiny policy.rule=allow
|
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=4 policy.commands=getdestiny policy.rule=allow
|
2008-04-29 18:41:24 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=4.4 policy.commands=getpostscript policy.rule=allow
|
2008-04-29 17:39:28 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab priority=4.5 policy.commands=getcredentials policy.rule=allow
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
2008-04-05 14:53:35 +00:00
|
|
|
|
|
|
|
if [ ! -d /etc/xcat/ca ]; then
|
2007-12-13 22:12:47 +00:00
|
|
|
yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-xcat-ca.sh "xCAT CA"
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
2008-02-19 18:25:39 +00:00
|
|
|
mkdir -p /install/postscripts/ca
|
2008-02-12 15:21:09 +00:00
|
|
|
cp -r /etc/xcat/ca/* /install/postscripts/ca
|
2008-04-05 14:53:35 +00:00
|
|
|
if [ ! -d /etc/xcat/cert ]; then
|
2007-12-13 22:12:47 +00:00
|
|
|
yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-server-cert.sh `hostname`
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
2008-02-19 18:25:39 +00:00
|
|
|
mkdir -p /install/postscripts/cert
|
2008-02-12 15:21:09 +00:00
|
|
|
cp -r /etc/xcat/cert/* /install/postscripts/cert
|
2007-10-26 22:44:33 +00:00
|
|
|
if [ ! -r /root/.xcat/client-key.pem ]; then
|
2007-12-13 22:12:47 +00:00
|
|
|
yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-local-client.sh root
|
2007-10-26 22:44:33 +00:00
|
|
|
fi
|
2008-04-30 20:54:57 +00:00
|
|
|
mkdir -p /install/postscripts/_xcat
|
|
|
|
cp -r /root/.xcat/* /install/postscripts/_xcat
|
2007-10-26 22:44:33 +00:00
|
|
|
#Zap the almost certainly wrong pxelinux.cfg file
|
2008-03-26 02:39:36 +00:00
|
|
|
if [ -r /tftpboot/pxelinux.cfg/default ]
|
|
|
|
then
|
|
|
|
rm /tftpboot/pxelinux.cfg/default
|
|
|
|
fi
|
2008-04-05 14:53:35 +00:00
|
|
|
# make Management Node
|
2008-03-31 16:17:39 +00:00
|
|
|
touch /etc/xCATMN
|
2008-11-20 17:43:54 +00:00
|
|
|
|
2008-02-18 13:10:47 +00:00
|
|
|
# setup syslog
|
2008-04-04 18:33:40 +00:00
|
|
|
/install/postscripts/syslog
|
2008-04-05 14:53:35 +00:00
|
|
|
#fi
|
2008-02-18 13:10:47 +00:00
|
|
|
|
2007-12-13 22:12:47 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 /etc/init.d/xcatd start
|
2008-01-17 18:23:31 +00:00
|
|
|
if [ -x $RPM_INSTALL_PREFIX0/sbin/mknb ]; then
|
2008-03-26 02:39:36 +00:00
|
|
|
%ifarch i386 i586 i686 x86 x86_64
|
2008-04-25 14:03:55 +00:00
|
|
|
$RPM_INSTALL_PREFIX0/sbin/mknb x86
|
2008-01-17 18:23:31 +00:00
|
|
|
$RPM_INSTALL_PREFIX0/sbin/mknb x86_64
|
2008-03-26 02:39:36 +00:00
|
|
|
%endif
|
|
|
|
%ifarch ppc ppc64
|
|
|
|
$RPM_INSTALL_PREFIX0/sbin/mknb ppc64
|
|
|
|
%endif
|
2008-01-17 18:23:31 +00:00
|
|
|
fi
|
2007-12-13 22:12:47 +00:00
|
|
|
$RPM_INSTALL_PREFIX0/sbin/makenetworks
|
2008-02-25 14:43:53 +00:00
|
|
|
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=nameservers site.value=`sed -e 's/#.*//' /etc/resolv.conf|grep nameserver|awk '{printf $2 ","}'|sed -e s/,$//`
|
2008-07-07 21:14:14 +00:00
|
|
|
chkconfig $apachename on
|
2008-10-17 17:59:57 +00:00
|
|
|
/etc/init.d/$apachename stop
|
|
|
|
/etc/init.d/$apachename start
|
2007-10-26 22:44:33 +00:00
|
|
|
echo "xCAT is now installed, it is recommended to tabedit networks and set a dynamic ip address range on any networks where nodes are to be discovered"
|
|
|
|
echo "Then, run makedhcp -n to create a new dhcpd.configuration file, and /etc/init.d/dhcpd restart"
|
|
|
|
echo "Either examine sample configuration templates, or write your own, or specify a value per node with nodeadd or tabedit."
|
|
|
|
fi
|
2008-01-23 18:00:13 +00:00
|
|
|
%endif
|
2007-10-26 22:44:33 +00:00
|
|
|
|
|
|
|
%clean
|
|
|
|
|
|
|
|
%files
|
2007-12-13 22:12:47 +00:00
|
|
|
%{prefix}
|
2008-07-09 14:10:24 +00:00
|
|
|
# one for sles, one for rhel. yes, it's ugly...
|
2007-10-26 22:44:33 +00:00
|
|
|
/etc/httpd/conf.d/xcat.conf
|
2008-07-07 21:14:14 +00:00
|
|
|
/etc/apache2/conf.d/xcat.conf
|
2007-10-26 22:44:33 +00:00
|
|
|
/install/postscripts
|
|
|
|
%defattr(-,root,root)
|