File cobbler.spec of Package cobbler.3314
#
# spec file for package cobbler
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?pyver: %define pyver %(%{__python} -c "import sys ; print sys.version[:3]" || echo 0)}
%if 0%{?suse_version}
%define www_path /srv/
%define apache_user wwwrun
%define apache_group www
%define apachedir apache2
%else
%define www_path %{_var}
%define apache_user apache
%define apache_group apache
%define apachedir httpd
%endif
%define _binaries_in_noarch_packages_terminate_build 0
%global debug_package %{nil}
Summary: Boot server configurator
License: GPL-2.0+
Group: Applications/System
Name: cobbler
AutoReq: no
Version: 2.6.6
Release: 1%{?dist}
Source0: cobbler-%{version}.tar.gz
Source1: vendor-files.tar.bz2
Source2: fence_ipmitool.sh
Source3: logrotate_cobbler
Patch2: cobbler_web_config.diff
Patch5: koan_old_cobbler_compat.diff
Patch6: looking_for_cobbler_order_changed.diff
Patch7: catch_cheetah_exception.patch
Patch9: fix-restart-paravirt-xen.dif
Patch10: disable_not_relevant_checks_bnc_828453.patch
Patch11: fix-powermanagement-status.dif
Patch13: fix_sle_detection.patch
Patch14: use_grub2_on_suse.diff
Patch16: fix-koan-port-guessing.dif
# PATCH-FIX-SLE name-of-file.patch bnc#883487 dmacvicar@suse.de
Patch18: cobbler-2.4.2-reprovision-rhel-on-suse-bnc883487.patch
Patch19: fix-broken-tests.diff
Patch20: fix_test_create_systems.diff
Patch21: remove_ks_directory_check.diff
Patch22: add_generic_sles_signatures.diff
Patch23: koan-virt-setup-suse.dif
Patch24: koan-no-xend.dif
Patch25: koan-detect-os_version.dif
Patch26: koan-use-kvm-acceleration-if-available.dif
Patch27: 0001-1398-koan-incompatible-with-F21-virt-install.patch
Patch28: virt-install-without-generic26.patch
Patch29: koan-improve-virt-install-error-reports.patch
# PATCH-FIX-cobbler20
Patch30: cobbler-modprobe-d.patch
Patch31: fix-cobbler-yaboot-handling.patch
Patch32: fix-error-message-in-cobblerd-status.dif
Patch33: 0001-cobbler-add-little-endian-powerpc-support.patch
Patch34: fix-cobbler-buildiso.dif
Patch35: cobbler-check-and-get-loaders-fix.patch
Patch36: fix-textmode-for-SUSE.dif
Patch37: adding-grub2-support-for-ppc.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
Url: http://www.cobblerd.org/
BuildRequires: git
BuildRequires: python-cheetah
%if 0%{?suse_version}
BuildRequires: apache2
BuildRequires: atftp
BuildRequires: distribution-release
BuildRequires: fdupes
Requires: apache2-mod_wsgi
Requires: ipmitool
Requires: python-PyYAML
%else
BuildRequires: redhat-rpm-config
Requires: PyYAML
Requires: httpd
Requires: mod_wsgi
%endif
Requires: createrepo
Requires: logrotate
Requires: python >= 2.3
Requires: python-cheetah
Requires: python-netaddr
Requires: python-simplejson
Requires: python-urlgrabber
Requires: rsync
%ifarch %ix86 x86_64
Requires: syslinux
%endif
%ifarch s390x
Requires: syslinux-x86_64
%endif
Requires: tftp(server)
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6 || 0%{?suse_version}
Requires: genisoimage
%else
Requires: mkisofs
%endif
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
Requires: python(abi) >= %{pyver}
%endif
%if 0%{?fedora} >= 8
BuildRequires: python-setuptools-devel
%else
BuildRequires: python-setuptools
%endif
%if 0%{?fedora} >= 6 || 0%{?rhel} >= 5 || 0%{?suse_version}
Requires: yum-utils
%endif
%if 0%{?fedora} >= 16
BuildRequires: systemd-units
Requires(post): systemd-sysv
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%else
%if 0%{?suse_version}
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
%else
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
%endif
%endif
%description
Cobbler is a network install server. Cobbler supports PXE,
virtualized installs, and re-installing existing Linux machines. The
last two modes use a helper tool, 'koan', that integrates with
cobbler. There is also a web interface 'cobbler-web'. Cobbler's
advanced features include importing distributions from DVDs and rsync
mirrors, kickstart templating, integrated yum mirroring, and built-in
DHCP/DNS Management. Cobbler has a XMLRPC API for integration with
other applications.
%prep
%setup -q
%setup -a1
%if 0%{?suse_version}
%patch2
%endif
%patch5
%patch6
%patch7 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch13 -p1
%if 0%{?suse_version}
%patch14 -p1
%endif
%patch16 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p0
%patch36 -p1
%patch37 -p1
mv vendor-files/cobbler.1.gz docs
%build
%{__python} setup.py build
%install
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/etc/%{apachedir}/conf.d
%{__python} setup.py install --optimize=1 --skip-build --root=$RPM_BUILD_ROOT $PREFIX
mkdir -p $RPM_BUILD_ROOT/var/spool/koan
%if 0%{?fedora} >= 9 || 0%{?rhel} > 5
mkdir -p $RPM_BUILD_ROOT/var/lib/tftpboot/images
%else
%if 0%{?suse_version}
mkdir -p $RPM_BUILD_ROOT/srv/tftpboot/images
%else
mkdir -p $RPM_BUILD_ROOT/tftpboot/images
%endif
%endif
rm -f $RPM_BUILD_ROOT/etc/cobbler/cobblerd
%if 0%{?suse_version}
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/SuSEfirewall2.d
mv vendor-files/cobbler_firewall_settings $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/cobbler
install -m 755 %{S:2} $RPM_BUILD_ROOT/usr/sbin/fence_ipmitool
ln -sf service $RPM_BUILD_ROOT/usr/sbin/rccobblerd
cp -r tests/ $RPM_BUILD_ROOT/usr/share/cobbler/
%endif
# create logrote config
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
install -m 644 %{S:3} $RPM_BUILD_ROOT/etc/logrotate.d/cobbler
%if 0%{?fedora} >= 16 || 0%{?suse_version}
rm -rf $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
mv $RPM_BUILD_ROOT%{_sysconfdir}/cobbler/cobblerd.service $RPM_BUILD_ROOT%{_unitdir}
%endif
%if 0%{?suse_version}
%fdupes %{buildroot}/usr
%endif
%if 0%{?suse_version}
%pre
%service_add_pre cobblerd.service
%post
if [ $1 -eq 1 ] ; then
# Initial installation
sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES proxy
sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES proxy_http
sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES proxy_connect
sysconf_addword /etc/sysconfig/apache2 APACHE_MODULES wsgi
elif [ "$1" -ge "2" ]; then
# backup config
if [ -e /var/lib/cobbler/distros ]; then
cp /var/lib/cobbler/distros* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/profiles* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/systems* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/repos* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/networks* /var/lib/cobbler/backup 2>/dev/null
fi
if [ -e /var/lib/cobbler/config ]; then
cp -a /var/lib/cobbler/config /var/lib/cobbler/backup 2>/dev/null
fi
# upgrade older installs
# move power and pxe-templates from /etc/cobbler, backup new templates to *.rpmnew
for n in power pxe; do
rm -f /etc/cobbler/$n*.rpmnew
find /etc/cobbler -maxdepth 1 -name "$n*" -type f | while read f; do
newf=/etc/cobbler/$n/`basename $f`
[ -e $newf ] && mv $newf $newf.rpmnew
mv $f $newf
done
done
# upgrade older installs
# copy kickstarts from /etc/cobbler to /var/lib/cobbler/kickstarts
rm -f /etc/cobbler/*.ks.rpmnew
find /etc/cobbler -maxdepth 1 -name "*.ks" -type f | while read f; do
newf=/var/lib/cobbler/kickstarts/`basename $f`
[ -e $newf ] && mv $newf $newf.rpmnew
cp $f $newf
done
# remove mod_python from apache
sysconf_addword -r /etc/sysconfig/apache2 APACHE_MODULES python >/dev/null 2>&1
fi
%service_add_post cobblerd.service
%preun
%service_del_preun cobblerd.service
%postun
%service_del_postun cobblerd.service
%else
# not SUSE starts here
%post
if [ "$1" = "1" ];
then
# This happens upon initial install. Upgrades will follow the next else
/sbin/chkconfig --add cobblerd
elif [ "$1" -ge "2" ];
then
# backup config
if [ -e /var/lib/cobbler/distros ]; then
cp /var/lib/cobbler/distros* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/profiles* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/systems* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/repos* /var/lib/cobbler/backup 2>/dev/null
cp /var/lib/cobbler/networks* /var/lib/cobbler/backup 2>/dev/null
fi
if [ -e /var/lib/cobbler/config ]; then
cp -a /var/lib/cobbler/config /var/lib/cobbler/backup 2>/dev/null
fi
# upgrade older installs
# move power and pxe-templates from /etc/cobbler, backup new templates to *.rpmnew
for n in power pxe; do
rm -f /etc/cobbler/$n*.rpmnew
find /etc/cobbler -maxdepth 1 -name "$n*" -type f | while read f; do
newf=/etc/cobbler/$n/`basename $f`
[ -e $newf ] && mv $newf $newf.rpmnew
mv $f $newf
done
done
# upgrade older installs
# copy kickstarts from /etc/cobbler to /var/lib/cobbler/kickstarts
rm -f /etc/cobbler/*.ks.rpmnew
find /etc/cobbler -maxdepth 1 -name "*.ks" -type f | while read f; do
newf=/var/lib/cobbler/kickstarts/`basename $f`
[ -e $newf ] && mv $newf $newf.rpmnew
cp $f $newf
done
# reserialize and restart
# FIXIT: ?????
#/usr/bin/cobbler reserialize
/sbin/service cobblerd condrestart
fi
%preun
if [ $1 = 0 ]; then
/sbin/service cobblerd stop >/dev/null 2>&1 || :
chkconfig --del cobblerd || :
fi
%postun
if [ "$1" -ge "1" ]; then
/sbin/service cobblerd condrestart >/dev/null 2>&1 || :
/sbin/service httpd condrestart >/dev/null 2>&1 || :
fi
%endif
%clean
test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_bindir}/cobbler
%{_bindir}/cobbler-ext-nodes
%{_bindir}/cobblerd
%{_sbindir}/tftpd.py*
%config(noreplace) /etc/logrotate.d/cobbler
%config(noreplace) %{_sysconfdir}/cobbler
%if 0%{?fedora} >= 16 || 0%{?suse_version}
%{_unitdir}/cobblerd.service
%else
/etc/init.d/cobblerd
%endif
%{python_sitelib}/cobbler
%config(noreplace) /var/lib/cobbler
%exclude /var/lib/cobbler/webui_sessions
/var/log/cobbler
/%{www_path}/www/cobbler
%{_mandir}/man1/cobbler.1.gz
%config(noreplace) /etc/%{apachedir}/conf.d/cobbler.conf
%if 0%{?fedora} >= 9 || 0%{?rhel} >= 5 || 0%{?suse_version}
%exclude %{python_sitelib}/cobbler/sub_process.py*
%endif
%if 0%{?fedora} >= 9 || 0%{?rhel} > 5 || 0%{?suse_version}
%{python_sitelib}/cobbler*.egg-info
%if 0%{?suse_version}
/srv/tftpboot/images
%else
/var/lib/tftpboot/images
%endif
%else
/tftpboot/images
%endif
%doc AUTHORS README COPYING
%if 0%{?suse_version}
%config /etc/sysconfig/SuSEfirewall2.d/cobbler
/usr/sbin/fence_ipmitool
/usr/sbin/rccobblerd
%endif
%package -n koan
Summary: Helper tool that performs cobbler orders on remote machines
Group: Applications/System
Requires: python >= 2.0
Requires: python-simplejson
Requires: virt-install
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
Requires: python(abi) >= %{pyver}
%endif
%description -n koan
Koan stands for kickstart-over-a-network and allows for both
network installation of new virtualized guests and reinstallation
of an existing system. For use with a boot-server configured with Cobbler
%files -n koan
%defattr(-,root,root,-)
%dir /var/spool/koan
%dir /var/lib/koan
%dir /var/lib/koan/config
%{_bindir}/koan
%{_bindir}/ovz-install
%{_bindir}/cobbler-register
%{python_sitelib}/koan
%if 0%{?fedora} >= 9 || 0%{?rhel} >= 5 || 0%{?suse_version}
%exclude %{python_sitelib}/koan/sub_process.py*
%exclude %{python_sitelib}/koan/opt_parse.py*
%exclude %{python_sitelib}/koan/text_wrap.py*
%endif
%{_mandir}/man1/koan.1.gz
%{_mandir}/man1/cobbler-register.1.gz
%dir /var/log/koan
%doc AUTHORS COPYING README
%package -n cobbler-web
Summary: Web interface for Cobbler
Group: Applications/System
Requires: cobbler
%if 0%{?fedora} >= 11 || 0%{?rhel} >= 6
Requires: Django >= 1.1.2
Requires: mod_ssl
Requires: mod_wsgi
Requires: python(abi) >= %{pyver}
%endif
%if 0%{?suse_version}
Requires: apache2-mod_wsgi
Requires: python-django
%endif
%description -n cobbler-web
Web interface for Cobbler that allows visiting
http://server/cobbler_web to configure the install server.
%post -n cobbler-web
# Change the SECRET_KEY option in the Django settings.py file
# required for security reasons, should be unique on all systems
RAND_SECRET=$(openssl rand -base64 40 | sed 's/\//\\\//g')
sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" /usr/share/cobbler/web/settings.py
%files -n cobbler-web
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
%config(noreplace) /etc/%{apachedir}/conf.d/cobbler_web.conf
%defattr(-,%{apache_user},%{apache_group},-)
/usr/share/cobbler/web
%dir %attr(700,%{apache_user},root) /var/lib/cobbler/webui_sessions
/%{www_path}/www/cobbler_webui_content/
%if 0%{?suse_version}
%dir /usr/share/cobbler
%endif
%if 0%{?suse_version}
%package -n cobbler-tests
Summary: Unit tests for Cobbler
Group: Applications/System
Requires: cobbler
%description -n cobbler-tests
Unit test files from the Cobbler project
%files -n cobbler-tests
%defattr(-,root,root,-)
/usr/share/cobbler/tests
%endif #suse_version
%changelog