diff --git a/makeclientrpm b/makeclientrpm index 654862185..1d57461d6 100755 --- a/makeclientrpm +++ b/makeclientrpm @@ -22,7 +22,7 @@ else pkg="packages" fi - tar czvf xCAT-client-2.0.tar.gz xCAT-client-2.0; + tar --exclude .svn -czvf xCAT-client-2.0.tar.gz xCAT-client-2.0; rm /usr/src/$pkg/RPMS/noarch/xCAT-client-2.0*rpm rpmbuild -ta xCAT-client-2.0.tar.gz ; #rpm -Uvh /usr/src/$pkg/RPMS/noarch/xCAT-client-2.0*rpm diff --git a/makeserverrpm b/makeserverrpm index ba041dc38..9cff079cf 100755 --- a/makeserverrpm +++ b/makeserverrpm @@ -21,7 +21,7 @@ else pkg="packages" fi - tar czvf xCAT-server-2.0.tar.gz xCAT-server-2.0; + tar --exclude .svn -czvf xCAT-server-2.0.tar.gz xCAT-server-2.0; rm /usr/src/$pkg/RPMS/noarch/xCAT-server-2.0*rpm rpmbuild -ta xCAT-server-2.0.tar.gz ; #rpm -Uvh /usr/src/$pkg/RPMS/noarch/xCAT-server-2.0*rpm diff --git a/perl-xCAT-2.0/perl-xCAT.spec b/perl-xCAT-2.0/perl-xCAT.spec index 0b8eb8c15..93a99fb00 100644 --- a/perl-xCAT-2.0/perl-xCAT.spec +++ b/perl-xCAT-2.0/perl-xCAT.spec @@ -8,7 +8,7 @@ Source: perl-xCAT-2.0.tar.gz Packager: IBM Corp. Vendor: IBM Corp. Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}} -Prefix: %{_prefix} +Prefix: /opt/xcat BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root %ifos linux BuildArch: noarch @@ -21,41 +21,39 @@ Provides perl xCAT libraries for core functionality. Required for all xCAT inst Includes xCAT::Table, xCAT::NodeRange, among others. %prep -%setup -q -n perl-xCAT-%{version} - +%setup -q %build -perl Makefile.PL -%{__make} %{?mflags} - %install -%{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install} -test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT/%{_datadir} ||: -test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT/%{_libdir}/perl5/5* ||: -find %{buildroot} -name "perllocal.pod" \ - -o -name ".packlist" \ - -o -name "*.bs" \ - |xargs -i rm -f {} +rm -rf $RPM_BUILD_ROOT -# ndebug - this seems to break the AIX build - need to investigate -%ifos linux -find %{buildroot}%{_prefix} \ - -type d -depth \ - -exec rmdir {} \; 2>/dev/null -%endif +mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/data +mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/perl-xCAT -find $RPM_BUILD_ROOT -type f | sed -e "s@$RPM_BUILD_ROOT@/@" > files.list +cp -r xCAT/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/ +chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/* +chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/data/* + +cp xCAT2.0.doc $RPM_BUILD_ROOT/%{prefix}/share/doc +cp xCAT2.0.pdf $RPM_BUILD_ROOT/%{prefix}/share/doc +chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/* + +cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/perl-xCAT +cp README $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/perl-xCAT +chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/perl-xCAT/* %clean -test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT +rm -rf $RPM_BUILD_ROOT -%files -f files.list +#find $RPM_BUILD_ROOT -type f | sed -e "s@$RPM_BUILD_ROOT@/@" > files.list + +%files %defattr(-, root, root) -%doc LICENSE.html -%doc README -%doc xCAT2.0.doc -%doc xCAT2.0.pdf - +#%doc LICENSE.html +#%doc README +#%doc xCAT2.0.doc +#%doc xCAT2.0.pdf +%{prefix} %changelog * Wed May 2 2007 - Norm Nott nott@us.ibm.com diff --git a/perl-xCAT-2.0/xCAT/Client.pm b/perl-xCAT-2.0/xCAT/Client.pm index 0976717e3..f44e12b4c 100644 --- a/perl-xCAT-2.0/xCAT/Client.pm +++ b/perl-xCAT-2.0/xCAT/Client.pm @@ -1,6 +1,11 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT::Client; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use xCAT::NodeRange; use xCAT::Utils; use xCAT::Table; @@ -35,7 +40,7 @@ my %resps; # in those directories will be loaded in as plugins (for duplicate # commands, last one in wins). If it is set to any other value # (e.g. "yes", "default", whatever string you want) the default plugin -# directory /usr/lib/xcat/plugins will be used. +# directory /opt/xcat/lib/perl/xCAT_plugin will be used. # # Input: # Request hash - A hash ref containing the input command and args to be @@ -80,12 +85,7 @@ sub submit_request { unless ($sitetab) { print ("ERROR: Unable to open basic site table for configuration\n"); } - $::XCATPREFIX = '/usr'; - my ($tmp) = $sitetab->getAttribs({'key'=>'xcatprefix'},'value'); - if ($tmp and $tmp->{value}) { - $::XCATPREFIX = $tmp->{value}; - } - $plugins_dir=$::XCATPREFIX.'/lib/xcat/plugins'; + $plugins_dir=$::XCATROOT.'/lib/perl/xCAT_plugin'; scan_plugins(); } diff --git a/perl-xCAT-2.0/xCAT/NotifHandler.pm b/perl-xCAT-2.0/xCAT/NotifHandler.pm index a54a7757f..b8856a1b9 100644 --- a/perl-xCAT-2.0/xCAT/NotifHandler.pm +++ b/perl-xCAT-2.0/xCAT/NotifHandler.pm @@ -1,6 +1,12 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html package xCAT::NotifHandler; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + use File::Basename qw(fileparse); #%notif is a cache that holds the info from the "notification" table. @@ -294,8 +300,8 @@ sub notify { if ($pid=fork()) { } elsif (defined($pid)) { if (($path eq "") || ($path eq ".\/")) { - #default path is /usr/lib/xcat/monitoring/ if there is no path specified - require "/usr/lib/xcat/monitoring/".$modname.".pm"; + #default path is /opt/xcat/lib/perl/xCAT_monitoring/ if there is no path specified + require "$::XCATROOT/lib/perl/xCAT_monitoring/".$modname.".pm"; } else { require $_; } diff --git a/perl-xCAT-2.0/xCAT/Table.pm b/perl-xCAT-2.0/xCAT/Table.pm index ccd3bf243..053ddd5ea 100644 --- a/perl-xCAT-2.0/xCAT/Table.pm +++ b/perl-xCAT-2.0/xCAT/Table.pm @@ -7,6 +7,11 @@ #but going for prototype #class xcattable package xCAT::Table; +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use DBI; diff --git a/xCAT-client-2.0/bin/getnodecfg b/xCAT-client-2.0/bin/getnodecfg index c81787f14..eb3f4d67d 100755 --- a/xCAT-client-2.0/bin/getnodecfg +++ b/xCAT-client-2.0/bin/getnodecfg @@ -1,5 +1,10 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use xCAT::Table; use xCAT::NodeRange; use IO::Socket::SSL; diff --git a/xCAT-client-2.0/bin/pping b/xCAT-client-2.0/bin/pping index d2361ef00..493c59b7d 100755 --- a/xCAT-client-2.0/bin/pping +++ b/xCAT-client-2.0/bin/pping @@ -4,6 +4,12 @@ #I've not had the time. Net::Ping shows perl code I could see being adapted for a somewhat #asynchronous ICMP ping (the tcp syn is interesting, but far too limited, and that is currently the only async #method Net::Ping provides. +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; + use IO::Socket::SSL; use XML::Simple; use Data::Dumper; diff --git a/xCAT-client-2.0/bin/psh b/xCAT-client-2.0/bin/psh index 1648b0f56..16c2fdcb1 100755 --- a/xCAT-client-2.0/bin/psh +++ b/xCAT-client-2.0/bin/psh @@ -1,5 +1,10 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use IO::Socket::SSL; use XML::Simple; use Data::Dumper; diff --git a/xCAT-client-2.0/bin/xcatDBcmds b/xCAT-client-2.0/bin/xcatDBcmds index 69cbc3dd9..e0cadcad6 100755 --- a/xCAT-client-2.0/bin/xcatDBcmds +++ b/xCAT-client-2.0/bin/xcatDBcmds @@ -1,5 +1,10 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use File::Basename; use xCAT::MsgUtils; diff --git a/xCAT-client-2.0/bin/xcatclient b/xCAT-client-2.0/bin/xcatclient index f3a988fd2..225828d07 100755 --- a/xCAT-client-2.0/bin/xcatclient +++ b/xCAT-client-2.0/bin/xcatclient @@ -1,5 +1,10 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use IO::Socket::SSL; use IO::Socket::INET; use File::Basename; diff --git a/xCAT-client-2.0/bin/xdsh b/xCAT-client-2.0/bin/xdsh index a50316ec8..1013f9121 100644 --- a/xCAT-client-2.0/bin/xdsh +++ b/xCAT-client-2.0/bin/xdsh @@ -1,5 +1,10 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use IO::Socket::SSL; use IO::Socket::INET; use File::Basename; diff --git a/xCAT-client-2.0/sbin/tabrestore b/xCAT-client-2.0/sbin/tabrestore index 433815a50..7381ee63a 100755 --- a/xCAT-client-2.0/sbin/tabrestore +++ b/xCAT-client-2.0/sbin/tabrestore @@ -1,6 +1,11 @@ #!/usr/bin/env perl # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html #Just like xcatclient, but needs to read a file in and pass it as $request->data +BEGIN +{ + $::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat'; +} +use lib "$::XCATROOT/lib/perl"; use IO::Socket::SSL; use IO::Socket::INET; use File::Basename; diff --git a/xCAT-client-2.0/xCAT-client.spec b/xCAT-client-2.0/xCAT-client.spec index 206b04b43..ee09bdc4d 100644 --- a/xCAT-client-2.0/xCAT-client.spec +++ b/xCAT-client-2.0/xCAT-client.spec @@ -8,7 +8,7 @@ Source: xCAT-client-2.0.tar.gz Packager: IBM Corp. Vendor: IBM Corp. Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}} -Prefix: /usr +Prefix: /opt/xcat BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root # AIX will build with an arch of "ppc" @@ -33,6 +33,7 @@ mkdir -p $RPM_BUILD_ROOT/%{prefix}/sbin mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/scripts mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man1 mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/man/man5 +mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-client cp bin/* $RPM_BUILD_ROOT/%{prefix}/bin chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/* @@ -42,6 +43,9 @@ cp share/man/man1/* $RPM_BUILD_ROOT/%{prefix}/share/man/man1 chmod 444 $RPM_BUILD_ROOT/%{prefix}/share/man/man1/* cp share/man/man5/* $RPM_BUILD_ROOT/%{prefix}/share/man/man5 chmod 444 $RPM_BUILD_ROOT/%{prefix}/share/man/man5/* +cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-client +cp README $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-client +chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-client/* #cp usr/share/xcat/scripts/setup-local-client.sh $RPM_BUILD_ROOT/usr/share/xcat/scripts/setup-local-client.sh #chmod 755 $RPM_BUILD_ROOT/usr/share/xcat/scripts/setup-local-client.sh @@ -90,8 +94,8 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%doc README -%doc LICENSE.html +#%doc README +#%doc LICENSE.html %{prefix} %changelog @@ -101,3 +105,24 @@ rm -rf $RPM_BUILD_ROOT * Tue Feb 20 2007 Jarrod Johnson - Start core rpm for 1.3 work +%post +%ifos linux +echo "XCATROOT=$XCATROOT +PATH=\$PATH:\$XCATROOT/bin:\$XCATROOT/sbin +MANPATH=\$MANPATH:\$XCATROOT/share/man +export XCATROOT PATH MANPATH" >/etc/profile.d/xcat.sh + +echo "setenv XCATROOT \"$XCATROOT\" +setenv PATH \${PATH}:\${XCATROOT}/bin:\${XCATROOT}/sbin +setenv MANPATH \${MANPATH}:\${XCATROOT}/share/man" >/etc/profile.d/xcat.csh +chmod 755 /etc/profile.d/xcat.* +%endif + +%preun +%ifos linux +if [ $1 == 0 ]; then #This means only on -e +rm /etc/profile.d/xcat.* +unset XCATROOT +fi +%endif +