2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-11-23 19:02:17 +00:00
Files
xcat-core/xCAT-server/xCAT-server.spec
T
Vinícius Ferrão 199e4733a7 feat(uftp): add the UFTP transfer listener
Booting nodes need a server that sends a published root image once to
every node that asks for it in a short window.

xcat-uftp-listener accepts HTTP/1.0 GET requests that name an image
path and its digest. It serves only an archive that packimage published
under the configured image roots, for a digest that the checksum file
lists. It keeps the archive open from the first request, so a later
packimage does not change the bytes of a queued batch. It collects the
requests for the same inode, digest and port for batch_delay seconds,
then runs one closed-group uftp session for the batch. Connections,
queued jobs, senders and receivers per job are limited.

The sender gets an argument vector built only from the configuration,
and signs the encrypted session with a persistent server key. It drops a
receiver that misses nearly every block of a section, so one node
without multicast cannot hold the session open. A sender that is not the
UFTP 5 build of xcat-dep is refused.

block_size allows larger packets on jumbo frame networks, up to the
8800-byte limit of uftp.

xCAT::UFTP holds the decisions of the listener: request checks, batches,
limits, timeouts and the runtime check. The script holds the sockets,
the key commands and the sender processes.

The packages install the service but do not enable it. Package removal
stops and disables it.
2026-10-21 11:44:21 -03:00

651 lines
26 KiB
RPMSpec

Summary: Server and configuration utilities of the xCAT management project
Name: xCAT-server
Version: %{?version:%{version}}%{!?version:%(cat Version)}
Release: %{?release:%{release}}%{!?release:%(cat Release)}
Epoch: 4
License: EPL
Group: Applications/System
Source: xCAT-server-%{version}.tar.gz
Packager: IBM Corp.
Vendor: IBM Corp.
Distribution: %{?_distribution:%{_distribution}}%{!?_distribution:%{_vendor}}
Prefix: /opt/xcat
BuildRoot: /var/tmp/%{name}-%{version}-%{release}-root
%ifnos linux
AutoReqProv: no
%endif
%define debug_package %{nil}
%define fsm %(if [ "$fsm" = "1" ];then echo 1; else echo 0; fi)
# Define local variable from environment variable
%define pcm %(if [ "$pcm" = "1" ];then echo 1; else echo 0; fi)
%define notpcm %(if [ "$pcm" = "1" ];then echo 0; else echo 1; fi)
%define s390x %(if [ "$s390x" = "1" ];then echo 1; else echo 0; fi)
%define nots390x %(if [ "$s390x" = "1" ];then echo 0; else echo 1; fi)
# Define a different location for various httpd configs in s390x mode
%define httpconfigdir %(if [ "$s390x" = "1" ];then echo "xcathttpdsave"; else echo "xcat"; fi)
# Disable shebang mangling of python scripts
%undefine __brp_mangle_shebangs
# AIX will build with an arch of "ppc"
# also need to fix Requires for AIX
%ifos linux
BuildArch: noarch
# Note: ifarch/ifnarch does not work for noarch package, use environment variable instead
%if %s390x
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl(Digest::SHA)
%else
%if 0%{?rhel} >= 8 || 0%{?openEuler}
BuildRequires: perl-generators
%endif
%if 0%{?fedora}
BuildRequires: perl-generators
%endif
Requires: perl-IO-Socket-SSL perl-XML-Simple perl-XML-Parser perl-Digest-SHA1 perl(Digest::SHA) perl(LWP::Protocol::https) perl-XML-LibXML
# AutoReqProv is off (above). Modules used only by xCAT-server code are
# therefore not auto-required, and (unlike SNMP, Expect, JSON, Net::Ping,
# Time::HiRes and Text::Balanced) are not pulled in transitively by perl-xCAT
# either. List them here or the affected subcommands die at load time.
Requires: perl-Net-Telnet perl-Net-DNS perl-Crypt-CBC perl-Crypt-Rijndael
# DB_File is only used by the Confluent client (lib/xcat/Confluent/Client.pm). EL10
# dropped libdb: EPEL still carries perl-DB_File for x86_64 and ppc64le, but riscv64 has
# no EPEL at all, so on EL10 ask for the module weakly -- it is installed where it exists
# and skipped where it cannot. The dependency generator still turns that "use DB_File"
# into a hard perl(DB_File) requirement; drop it there too, appending to any filter the
# build root already set. Every other platform keeps the hard requirement it has today.
%if 0%{?rhel} >= 10
Recommends: perl-DB_File
%global __requires_exclude %{?__requires_exclude:%{__requires_exclude}|}^perl\\(DB_File\\)$
%else
Requires: perl-DB_File
%endif
%endif
Obsoletes: atftp-xcat
%endif
# The aix rpm cmd forces us to do this outside of ifos type stmts
%if %notpcm
%ifos linux
#
# PCM does not use or ship grub2-xcat
%if %nots390x
Requires: grub2-xcat >= 2.02-0.76.el7.1.snap201905160255
Requires: perl-Net-HTTPS-NB >= 0.14-3
Requires: perl-HTTP-Async >= 0.30-3
%endif
%endif
%endif
%if 0%{?rhel} && 0%{?rhel} < 7
Requires: initscripts
Requires: chkconfig
%endif
# openssl is present on all EL; require it uniformly (not just el10) so a single
# flat xcat-core build is correct everywhere. Excluded on SLES, where the package
# name differs and it was never required before.
%if !0%{?suse_version}
Requires: openssl
%endif
%if %fsm
# nothing needed here
%else
%ifos linux
# do this for non-fsm linux
Requires: perl-IO-Tty perl-Crypt-SSLeay make httpd
%endif
%endif
Requires: perl-xCAT = 4:%{version}-%{release}
Requires: xCAT-client = 4:%{version}-%{release}
%description
xCAT-server provides the core server and configuration management components of xCAT. This package should be installed on your management server
%define zvm %(if [ "$zvm" = "1" ];then echo 1; else echo 0; fi)
%prep
# %if %NOVERBOSE
# echo NOVERBOSE is on
# set +x
# %elseif
# set -x
# %endif
%setup -q -n xCAT-server
%build
# build the tools readme files from the --help output of all of the tools
./build-readme
%install
rm -rf $RPM_BUILD_ROOT
#cp foo bar
mkdir -p $RPM_BUILD_ROOT/%{prefix}/sbin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
#mkdir -p $RPM_BUILD_ROOT/%{prefix}/rc.d
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ca
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/mypostscript
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/scripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/samples
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/tools
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/conf
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/rollupdate
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/installp_bundles
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/image_data
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/scripts
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/netboot/sles
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/netboot/rh
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/scripts/Mellanox
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/devicetype
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/xcat/hamn
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin
mkdir -p $RPM_BUILD_ROOT/%{prefix}/xdsh/Context
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/samples
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/pcp
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/Confluent
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema/samples
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT
%ifos linux
cp -a share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -a share/xcat/netboot/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/
# Preserve netboot dracut aliases as symlinks so rpm upgrades do not fail when
# replacing older xCAT-server packages that already own these paths as symlinks.
for _required_symlink in \
SL/dracut_033 \
alma/dracut alma/dracut_033 alma/dracut_047 \
centos/dracut centos/dracut_033 centos/dracut_047 \
fedora/dracut_047 \
ol/dracut ol/dracut_033 ol/dracut_047 \
rocky/dracut rocky/dracut_033 rocky/dracut_047 rocky/dracut_105
do
_target="$RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/${_required_symlink}"
if [ ! -L "$_target" ]; then
echo "ERROR: expected symlink missing or dereferenced: $_target" >&2
exit 1
fi
done
%else
cp -hpR share/xcat/install/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/install/
cp -hpR share/xcat/netboot/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/
%endif
%ifos linux
# pwd
cp -d sbin/* $RPM_BUILD_ROOT/%{prefix}/sbin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/sbin/*
cp -d bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
%else
cp -h sbin/* $RPM_BUILD_ROOT/%{prefix}/sbin
chmod -h 755 $RPM_BUILD_ROOT/%{prefix}/sbin/*
cp -h bin/* $RPM_BUILD_ROOT/%{prefix}/bin
chmod -h 755 $RPM_BUILD_ROOT/%{prefix}/bin/*
%endif
#cp rc.d/* $RPM_BUILD_ROOT/%{prefix}/rc.d
#chmod 755 $RPM_BUILD_ROOT/%{prefix}/rc.d/*
cp share/xcat/ca/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/ca
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/xcat/ca/*
cp share/xcat/mypostscript/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/mypostscript
cp share/xcat/scripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/scripts
cp share/xcat/conf/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/conf
cp -r share/xcat/samples/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/samples
cp -r share/xcat/tools/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/tools
cp -r share/xcat/hamn/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/hamn
cp share/xcat/rollupdate/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/rollupdate
cp share/xcat/installp_bundles/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/installp_bundles
cp share/xcat/image_data/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/image_data
cp share/xcat/cons/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons
ln -sf kvm $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons/mic
cp -r share/xcat/ib/scripts/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/scripts
cp share/xcat/ib/netboot/sles/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/netboot/sles
cp share/xcat/ib/netboot/rh/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/netboot/rh
cp -r share/xcat/devicetype/* $RPM_BUILD_ROOT/%{prefix}/share/xcat/devicetype
ln -sf Jun $RPM_BUILD_ROOT/%{prefix}/share/xcat/devicetype/EthSwitch/Juniper
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons/*
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/scripts/*
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/netboot/sles/*
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/ib/netboot/rh/*
cp lib/xcat/plugins/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/*
cp lib/perl/xCAT/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/*
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/sles/*.postinstall
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/rh/*.postinstall
# For now, don't ship these plugins on AIX to avoid AIX dependency.
%ifnos linux
rm $RPM_BUILD_ROOT/%{prefix}/sbin/stopstartxcatd
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/blade.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpblade.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpilo.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipmi.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/nodediscover.pm
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/switch.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xen.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/kvm.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/vbox.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/activedirectory.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/kit.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/confluent.pm
%endif
cp lib/xcat/dsh/Context/* $RPM_BUILD_ROOT/%{prefix}/xdsh/Context
chmod 644 $RPM_BUILD_ROOT/%{prefix}/xdsh/Context/*
cp -r lib/xcat/monitoring/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/*
chmod 755 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/samples
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/samples/*
chmod 755 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/pcp
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/pcp/*
cp -r lib/xcat/Confluent/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/Confluent
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/Confluent/*
cp -r lib/xcat/schema/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema/*
chmod 755 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema/samples
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_schema/samples/*
# Don't ship these on zVM, to reduce dependencies
%if %zvm
rm $RPM_BUILD_ROOT/%{prefix}/sbin/stopstartxcatd
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/activedirectory.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/blade.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpblade.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpilo.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipmi.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/nodediscover.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/switch.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xen.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/kvm.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/vbox.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/aixinstall.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/slpdiscover.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/remoteimmsetup.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/IMMUtils.pm
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/RShellAPI.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/bmcconfig.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/bpa.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/esx.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/FIP.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/fsp.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hmc.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ivm.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/lsslp.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/pxe.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/toolscenter.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/windows.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xcat2nim.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/rhevm.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xnba.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipxe.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/IPMI.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/SSHInteract.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/MellanoxIB.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/PPC.pm
# Can not remove this, because it is needed by Templates.pm
#rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/ADUtils.pm
rm $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons/hmc
rm $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons/ivm
rm $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons/multiple
rm $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons/fsp
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/snmpmon.pm
rm $RPM_BUILD_ROOT/%{prefix}/sbin/xcat_traphandler
%endif
# Don't ship these on FSM, to reduce dependencies
%if %fsm
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/installp_bundles
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/cons
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/install
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/add-on
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/aix
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/centos
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/debian
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/esxi/48.esxifixup
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/esxi/xcatsplash
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/fedora*
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/imgutils
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/mic
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/rh
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/ol
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/devicetype
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/SL
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/sles
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/suse
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/syslinux
rm -rf $RPM_BUILD_ROOT/%{prefix}/share/xcat/netboot/ubuntu
rm $RPM_BUILD_ROOT/%{prefix}/sbin/stopstartxcatd
rm $RPM_BUILD_ROOT/%{prefix}/sbin/rshell_api
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpblade.pm
rm $RPM_BUILD_ROOT/%{prefix}/share/xcat/tools/detect_dhcpd
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/AAsn.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hpilo.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipmi.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/blade.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/nodediscover.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/switch.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xen.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/kvm.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/vbox.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/aixinstall.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/bmcconfig.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/bpa.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ddns.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/dhcp.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/FIP.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/fsp.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/hmc.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ivm.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/lsslp.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/slpdiscover.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/remoteimmsetup.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/IMMUtils.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/RShellAPI.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/pxe.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/toolscenter.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xcat2nim.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/xnba.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/ipxe.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/IPMI.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/SSHInteract.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/MellanoxIB.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT/PPC.pm
rm $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_monitoring/snmpmon.pm
rm $RPM_BUILD_ROOT/%{prefix}/sbin/xcat_traphandler
%endif
cp lib/xcat/shfunctions $RPM_BUILD_ROOT/%{prefix}/lib
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/shfunctions
%if %fsm
%else
%ifos linux
cp etc/init.d/xcatd $RPM_BUILD_ROOT/%{prefix}/share/xcat/scripts/xcatd
chmod 755 $RPM_BUILD_ROOT/%{prefix}/share/xcat/scripts/xcatd
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system
cp etc/init.d/xcatd.service $RPM_BUILD_ROOT/usr/lib/systemd/system
cp etc/init.d/xcat-uftp-listener.service $RPM_BUILD_ROOT/usr/lib/systemd/system
%else
mkdir -p $RPM_BUILD_ROOT/etc/init.d
cp etc/init.d/xcatd $RPM_BUILD_ROOT/etc/init.d
%endif
%endif
#TODO: the next has to me moved to postscript, to detect /etc/xcat vs /etc/opt/xcat
mkdir -p $RPM_BUILD_ROOT/etc/%httpconfigdir
mkdir -p $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-server
cp LICENSE.html $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-server
chmod 644 $RPM_BUILD_ROOT/%{prefix}/share/doc/packages/xCAT-server/*
#echo $RPM_BUILD_ROOT %{prefix}
# genereate the configuration files for web service (REST API)
mkdir -p $RPM_BUILD_ROOT/%{prefix}/ws
mkdir -p $RPM_BUILD_ROOT/etc/apache2/conf.d
mkdir -p $RPM_BUILD_ROOT/etc/httpd/conf.d
mkdir -p $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig
cp xCAT-wsapi/* $RPM_BUILD_ROOT/%{prefix}/ws
# PCM does not need xcatws.cgi
# xcatws.cgi causes xCAT-server requires perl-JSON, which is not shipped with PCM
%if %pcm
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcatws.cgi
%endif
%if %nots390x
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/zvmxcatws.cgi
%endif
%if %fsm
%else
echo "ScriptAlias /xcatrhevh %{prefix}/ws/xcatrhevh.cgi" > $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ws.conf
%if %notpcm
%if %nots390x
echo "ScriptAlias /xcatws %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ws.conf
%else
# Add in old version 1 REST-API and version 2 REST-API to z/VM, default to version 1
echo "ScriptAlias /xcatwsv2 %{prefix}/ws/xcatws.cgi" >> $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ws.conf
echo "ScriptAlias /xcatws %{prefix}/ws/zvmxcatws.cgi" >> $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ws.conf
%endif
%endif
cat $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf >> $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ws.conf
# One fragment serves Apache 2.2 and 2.4, so the payload is also the final file.
cp $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ws.conf $RPM_BUILD_ROOT/etc/apache2/conf.d/xcat-ws.conf
cp $RPM_BUILD_ROOT/etc/%httpconfigdir/conf.orig/xcat-ws.conf $RPM_BUILD_ROOT/etc/httpd/conf.d/xcat-ws.conf
%endif
rm -f $RPM_BUILD_ROOT/%{prefix}/ws/xcat-ws.conf
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
#%doc LICENSE.html
%{prefix}
/etc/%httpconfigdir
%if %fsm
%else
%ifos linux
# The compatibility helper owns runtime cleanup. Listing this path as %ghost
# would let RPM unlink preserved administrator content after %preun.
/usr/lib/systemd/system/xcatd.service
/usr/lib/systemd/system/xcat-uftp-listener.service
%else
/etc/init.d/xcatd
%endif
/etc/apache2/conf.d/xcat-ws.conf
/etc/httpd/conf.d/xcat-ws.conf
%endif
%changelog
* Fri Jul 6 2018 - Bin Xu <bxuxa@cn.ibm.com>
- Added systemd unit file
* Tue Nov 20 2007 - Jarrod Johnson <jbjohnso@us.ibm.com>
- Changes for relocatible rpm.
* Wed May 2 2007 - Norm Nott <nott@us.ibm.com>
- Made changes to make this work on AIX
* Tue Feb 27 2007 Jarrod Johnson <jbjohnso@us.ibm.com>
- Spawn server rpm for the server half of things, fix requires
* Tue Feb 20 2007 Jarrod Johnson <jbjohnso@us.ibm.com>
- Start core rpm for 1.3 work
%pre
# only need to check on AIX
%ifnos linux
if [ -x /usr/sbin/emgr ]; then # Check for emgr cmd
/usr/sbin/emgr -l 2>&1 | grep -i xCAT # Test for any xcat ifixes - msg and exit if found
if [ $? = 0 ]; then
echo "Error: One or more xCAT emgr ifixes are installed. You must use the /usr/sbin/emgr command to uninstall each xCAT emgr ifix prior to RPM installation."
exit 2
fi
fi
%endif
# The Juniper directory is switched to Jun and a sylink is created
if [ -d $RPM_INSTALL_PREFIX0/share/xcat/devicetype/EthSwitch/Juniper ]; then
# need to remove the old directory otherwise the symlink won't get creatd correctly
rm -rf $RPM_INSTALL_PREFIX0/share/xcat/devicetype/EthSwitch/Juniper
fi
# Newer xCAT-server payloads replace legacy dracut symlinks with real
# directories/files in several distro trees. Remove the old symlinks up front
# so RPM can upgrade the package cleanly.
for distro in SL alma centos fedora ol rocky; do
if [ -d "$RPM_INSTALL_PREFIX0/share/xcat/netboot/$distro" ]; then
find "$RPM_INSTALL_PREFIX0/share/xcat/netboot/$distro" \
-maxdepth 2 -type l -name 'dracut*' -exec rm -f {} +
fi
done
%post
%ifos linux
ln -sf $RPM_INSTALL_PREFIX0/sbin/xcatd /usr/sbin/xcatd
ln -sf $RPM_INSTALL_PREFIX0/share/xcat/install/sles $RPM_INSTALL_PREFIX0/share/xcat/install/sle
ln -sf $RPM_INSTALL_PREFIX0/share/xcat/netboot/sles $RPM_INSTALL_PREFIX0/share/xcat/netboot/sle
ln -sf $RPM_INSTALL_PREFIX0/share/xcat/install/centos $RPM_INSTALL_PREFIX0/share/xcat/install/centos-stream
ln -sf $RPM_INSTALL_PREFIX0/share/xcat/netboot/centos $RPM_INSTALL_PREFIX0/share/xcat/netboot/centos-stream
xcatd_init_compat=$RPM_INSTALL_PREFIX0/share/xcat/scripts/xcatd-init-compat
export XCATROOT="$RPM_INSTALL_PREFIX0"
if [ "$1" = "1" ]; then #Only if installing for the first time..
if "$xcatd_init_compat" uses-systemd --explicit-target; then
"$xcatd_init_compat" configure --explicit-target || exit 1
if "$xcatd_init_compat" can-use-systemctl; then
systemctl daemon-reload
fi
if command -v systemctl >/dev/null 2>&1; then
systemctl enable xcatd.service
fi
else
"$xcatd_init_compat" configure --explicit-target --track-managed || exit 1
legacy_xcatd_state=$("$xcatd_init_compat" legacy-state)
case "$legacy_xcatd_state" in
enabled|disabled)
# Preserve any pre-existing administrator runlevel layout.
:
;;
*)
# Preserve the script's declared defaults on first install.
if [ "$("$xcatd_init_compat" systemd-state)" != masked ]; then
"$xcatd_init_compat" register-legacy default
fi
;;
esac
fi
fi
if [ "$1" -gt "1" ]; then #only on upgrade...
if "$xcatd_init_compat" uses-systemd --explicit-target; then
legacy_xcatd_state=$("$xcatd_init_compat" legacy-state)
"$xcatd_init_compat" unregister-legacy
"$xcatd_init_compat" configure --explicit-target || exit 1
%if 0%{?suse_version}
%else
# Remove only an empty directory left by an older xCAT RPM. SUSE base
# packages own /etc/init.d, so leave that directory intact there.
rmdir /etc/init.d 2>/dev/null || true
%endif
if "$xcatd_init_compat" can-use-systemctl; then
systemctl daemon-reload
fi
if [ "$legacy_xcatd_state" = enabled ] && command -v systemctl >/dev/null 2>&1; then
# Preserve the previous enabled state without enabling HA nodes by default.
systemctl enable xcatd.service
fi
else
legacy_xcatd_registration=$("$xcatd_init_compat" legacy-state)
legacy_xcatd_state=$("$xcatd_init_compat" legacy-transition-state)
"$xcatd_init_compat" disable-systemd --links-only
# systemctl may delegate to systemd-sysv-install and recreate K links for
# a pre-existing SysV script. Restore the captured unregistered or masked
# state before materializing the package's replacement script.
case "$legacy_xcatd_state" in
masked|unregistered)
"$xcatd_init_compat" unregister-legacy
;;
esac
# This path was previously a regular RPM payload file, so upgrades replaced
# it with the current package version rather than retaining an older copy.
"$xcatd_init_compat" configure --replace --explicit-target --track-managed || exit 1
case "$legacy_xcatd_state" in
enabled|disabled)
if [ "$legacy_xcatd_registration" = unregistered ]; then
"$xcatd_init_compat" register-legacy "$legacy_xcatd_state"
fi
;;
masked|unregistered)
;;
esac
fi
#migration issue for monitoring
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab filename=monitorctrl.pm notification -d
fi
%else
if [ "$1" -gt "1" ]; then #only on upgrade for AIX...
#migration issue for monitoring
XCATROOT=$RPM_INSTALL_PREFIX0 $RPM_INSTALL_PREFIX0/sbin/chtab filename=monitorctrl.pm notification -d
fi
%endif
# SUSE does not load mod_rewrite by default. A no-op where a2enmod is absent.
if command -v a2enmod >/dev/null 2>&1; then
a2enmod rewrite >/dev/null 2>&1 || :
fi
exit 0
%posttrans
%ifos linux
xcatd_init_compat=$RPM_INSTALL_PREFIX0/share/xcat/scripts/xcatd-init-compat
# During upgrades from pre-compatibility RPMs, old payload cleanup can remove
# the generated init script after the new post-install scriptlet. Restore only
# a missing runtime script so fresh installs retain administrator-managed files.
if [ -x "$xcatd_init_compat" ] &&
! XCATROOT="$RPM_INSTALL_PREFIX0" "$xcatd_init_compat" uses-systemd --explicit-target &&
[ ! -e /etc/init.d/xcatd ] && [ ! -L /etc/init.d/xcatd ]; then
XCATROOT="$RPM_INSTALL_PREFIX0" \
"$xcatd_init_compat" configure --explicit-target --track-managed || exit 1
fi
%endif
%preun
%ifos linux
xcatd_init_compat=$RPM_INSTALL_PREFIX0/share/xcat/scripts/xcatd-init-compat
export XCATROOT="$RPM_INSTALL_PREFIX0"
if [ $1 == 0 ]; then #This means only on -e
if [ -f "/proc/cmdline" ]; then # prevent running it during install into chroot image
if "$xcatd_init_compat" can-use-systemctl; then
systemctl stop xcatd.service
systemctl disable --now xcat-uftp-listener.service >/dev/null 2>&1 || true
elif ! "$xcatd_init_compat" uses-systemd --explicit-target && [ -x /etc/init.d/xcatd ]; then
/etc/init.d/xcatd stop
fi
fi
# Preserve RPM's existing recoverable erase policy if local service state
# cannot be cleaned completely; no package payload remains afterward.
"$xcatd_init_compat" unregister-all || true
"$xcatd_init_compat" remove-managed || true
rm -f /usr/sbin/xcatd #remove the symbolic
fi
%endif