made xCAT meta package relocatable, default location is /opt/xcat

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@181 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
linggao 2007-12-13 22:12:47 +00:00
parent fb76d32243
commit d58ff3f8b3

View File

@ -7,7 +7,7 @@ Group: Applications/System
Vendor: IBM Corp.
Packager: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: %{_prefix}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
BuildArch: noarch
Source1: xcat.conf
@ -17,8 +17,7 @@ Source3: templates.tar.gz
Provides: xCAT = %{version}
Requires: xCAT-server xCAT-client perl-DBD-SQLite perl-xCAT xCAT-nbroot-oss-x86_64 xCAT-nbroot-core-x86_64 xCAT-nbkernel-x86_64 tftp-server dhcp httpd nfs-utils expect conserver fping bind
Requires: ipmitool >= 1.8.9
#Requires: xCAT-server xCAT-client perl-DBD-SQLite perl-xCAT xCAT-nbroot-oss-x86_64 xCAT-nbroot-core-x86_64 xCAT-nbroot-ppc64 xCAT-nbkernel-x86_64 xCAT-nbkernel-ppc64 tftp-server dhcp httpd nfs-utils expect
#Requires: xCAT-server xCAT-client perl-xCAT
%description
xCAT is a server management package intended for at-scale management, including
hardware management and software management.
@ -29,8 +28,8 @@ tar zxvf %{SOURCE2}
%install
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d/
mkdir -p $RPM_BUILD_ROOT/install/postscripts
mkdir -p $RPM_BUILD_ROOT/usr/share/xcat/
cd $RPM_BUILD_ROOT/usr/share/xcat/
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/
cd $RPM_BUILD_ROOT/%{prefix}/share/xcat/
tar zxvf %{SOURCE3}
cd -
cd $RPM_BUILD_ROOT/install
@ -39,6 +38,10 @@ rm LICENSE.html
mkdir -p postscripts/hostkeys
cd -
cp %{SOURCE1} $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat.conf
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT
%post
if [ ! -f /install/postscripts/hostkeys/ssh_host_key ]; then
echo Generating SSH1 RSA Key...
@ -66,35 +69,35 @@ if [ "$1" = "1" ]; then #Only if installing for the fist time..
chkconfig nfs on
fi
if [ ! -r /etc/xcat/site.sqlite ]; then
chtab key=xcatdport site.value=3001
chtab key=xcatiport site.value=3002
chtab key=master site.value=$(getent hosts `hostname`|awk '{print $1}')
chtab key=domain site.value=$(hostname -d)
chtab key=installdir site.value=/install
chtab key=timezone site.value=`grep ^ZONE /etc/sysconfig/clock|cut -d= -f 2|sed -e 's/"//g'`
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
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
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'`
fi
if [ ! -r /etc/xcat/policy.sqlite ]; then
chtab priority=1 policy.name=root policy.rule=allow
chtab priority=2 policy.commands=getbmcconfig policy.rule=allow
chtab priority=3 policy.commands=nextdestiny policy.rule=allow
chtab priority=4 policy.commands=getdestiny policy.rule=allow
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
fi
if [ ! -d /etc/xcat/ca ]; then
yes | /usr/share/xcat/scripts/setup-xcat-ca.sh "xCAT CA"
yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-xcat-ca.sh "xCAT CA"
fi
if [ ! -d /etc/xcat/cert ]; then
yes | /usr/share/xcat/scripts/setup-server-cert.sh `hostname`
yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-server-cert.sh `hostname`
fi
if [ ! -r /root/.xcat/client-key.pem ]; then
yes | /usr/share/xcat/scripts/setup-local-client.sh root
yes | $RPM_INSTALL_PREFIX0/share/xcat/scripts/setup-local-client.sh root
fi
#Zap the almost certainly wrong pxelinux.cfg file
rm /tftpboot/pxelinux.cfg/default
/etc/init.d/xcatd start
mknb x86_64
makenetworks
chtab key=nameservers site.value=`grep nameserver /etc/resolv.conf|awk '{printf $2 ","}'|sed -e s/,$//`
XCATROOT=$RPM_INSTALL_PREFIX0 /etc/init.d/xcatd start
$RPM_INSTALL_PREFIX0/sbin/mknb x86_64
$RPM_INSTALL_PREFIX0/sbin/makenetworks
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab key=nameservers site.value=`grep nameserver /etc/resolv.conf|awk '{printf $2 ","}'|sed -e s/,$//`
service httpd restart
chkconfig httpd on
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"
@ -105,8 +108,7 @@ fi
%clean
%files
%{prefix}
/etc/httpd/conf.d/xcat.conf
/install/postscripts
/usr/share/xcat/templates
%doc LICENSE.html
%defattr(-,root,root)