%global gitdate 20160508 %global commit0 79c8a8b5c4d21d5c528f791a945be03724cc5928 Name: webvirtmgr Version: 4.8.9 Release: 2.%{gitdate}git%{?dist} Summary: %{name} panel for manage virtual machine License: ASL 2.0 URL: https://github.com/retspen/%{name} %if 0%{?gitdate} Source0: %{url}/archive/%{commit0}.tar.gz#/%{name}-%{commit0}.tar.gz %else Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz %endif %if 0%{?rhel} >= 7 || 0%{?fedora} %bcond_without systemd # enabled BuildRequires: systemd %{?systemd_requires} %else %bcond_with systemd # disabled Requires(post): chkconfig Requires(postun): /sbin/service Requires(preun): /sbin/service Requires(preun): chkconfig %endif BuildArch: noarch # TODO check compatibility/port to python3 BuildRequires: python2-devel BuildRequires: python-setuptools Requires: libvirt-python Requires: libxml2-python Requires: python-websockify Requires: python-gunicorn Requires: python-lockfile Requires: python-django Requires: libvirt qemu-kvm %description %{name} is a libvirt-based Web interface for managing virtual machines. It allows you to create and configure new domains, and adjust a domain resource allocation. A VNC viewer presents a full graphical console to the guest domain. KVM is currently the only hypervisor supported. %prep %if 0%{?gitdate} %autosetup -n%{name}-%{commit0} %else %autosetup %endif %build %py2_build %install %py2_install cp -pr templates %{buildroot}%{python_sitelib}/%{name}/ cp -pr %{name}/static %{buildroot}%{python_sitelib}/%{name}/ mkdir -p %{buildroot}%{python_sitelib}/%{name}/conf cp -p conf/gunicorn.conf.py %{buildroot}%{python_sitelib}/%{name}/conf/gunicorn.conf.py %if %{with systemd} mkdir -p %{buildroot}%{_unitdir} install -m0644 -p conf/init/%{name}*.service %{buildroot}%{_unitdir} %else mkdir -p %{buildroot}%{_sysconfdir}/init cp -p conf/init/%{name}-redhat.conf %{buildroot}%{_sysconfdir}/init/%{name}.conf mkdir -p %{buildroot}%{_sysconfdir}/init.d cp -p conf/initd/%{name}-console-redhat %{buildroot}%{_sysconfdir}/init.d/%{name}-console %endif cp manage.py %{buildroot}%{python2_sitelib}/%{name}/ rm %{buildroot}%{_bindir}/manage.py %post %if %{with systemd} %systemd_post %{name}.service %systemd_post %{name}-console.service %else /sbin/chkconfig --add %{name} /sbin/chkconfig --add %{name}-console %endif %preun %if %{with systemd} %systemd_preun %{name}.service %systemd_preun %{name}-console.service %else if [ $1 -eq 0 ]; then /sbin/stop %{name} >/dev/null 2>&1 || : /sbin/chkconfig --del %{name} /sbin/service %{name} stop >/dev/null 2>&1 || : /sbin/chkconfig --del %{name}-console fi %endif %postun %if %{with systemd} %systemd_postun_with_restart %{name}.service %systemd_postun_with_restart %{name}-console.service %else if [ $1 -ge 1 ]; then /sbin/restart %{name} >/dev/null 2>&1 || : /sbin/service %{name}-console restart >/dev/null 2>&1 || : fi %endif %files %{python2_sitelib}/* %config %{python2_sitelib}/%{name}/conf/gunicorn.conf.py %if %{with systemd} %{_unitdir}/%{name}*.service %else %{_sysconfdir}/init/* %{_sysconfdir}/init.d/* %endif %changelog * Wed Sep 28 2016 Raphael Groner - 4.8.9-2.20160508git - prepare for review * Mon Jan 18 2016 Giacomo Sanchietti - 4.8.9-1 - Support rhel 7 - Upgrade to 4.8.9 * Wed Jan 26 2015 Edoardo Spadoni - 4.8.8-1 - first version