This repository has been archived by the owner on Mar 8, 2018. It is now read-only.
forked from retspen/webvirtmgr
-
Notifications
You must be signed in to change notification settings - Fork 8
/
webvirtmgr.spec
127 lines (106 loc) · 3.54 KB
/
webvirtmgr.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
%global name webvirtmgr
%global version 4.8.9
%global release 1
Name: %{name}
Version: %{version}
Release: %{release}%{?dist}
Summary: WebVirtMgr panel for manage virtual machine
License: Apache Licence, Version 2.0
URL: http://github.com/retspen/webvirtmgr
Source0: https://github.com/retspen/webvirtmgr/archive/master.tar.gz
%if 0%{?rhel} >= 7 || 0%{?fedora}
%bcond_without systemd # enabled
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%else
%bcond_with systemd # disabled
Requires(post): chkconfig
Requires(postun): /sbin/service
Requires(preun): /sbin/service
Requires(preun): chkconfig
%endif
BuildArch: noarch
BuildRequires: python-setuptools
Requires: python-setuptools libvirt-python libxml2-python python-websockify python-gunicorn python-lockfile
%if 0%{?rhel} >= 7
Requires: python-django
%else
Requires: python-django15
%endif
Requires: libvirt qemu-kvm
%description
WebVirtMgr 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
%setup -n %{name}-master
%build
%{__python} setup.py build
%install
%{__python} setup.py install --skip-build --install-lib=%{python_sitelib}/%{name} --root %{buildroot}
cp -r templates %{buildroot}%{python_sitelib}/%{name}/
cp -r webvirtmgr/static %{buildroot}%{python_sitelib}/%{name}/
mkdir -p %{buildroot}%{python_sitelib}/%{name}/conf
cp conf/gunicorn.conf.py %{buildroot}%{python_sitelib}/%{name}/conf/gunicorn.conf.py
%if %{with systemd}
mkdir -p %{buildroot}%{_unitdir}
install -m0644 conf/init/webvirtmgr-console.service %{buildroot}%{_unitdir}/webvirtmgr-console.service
install -m0644 conf/init/webvirtmgr.service %{buildroot}%{_unitdir}/webvirtmgr.service
%else
mkdir -p %{buildroot}%{_sysconfdir}/init
cp conf/init/webvirtmgr-redhat.conf %{buildroot}%{_sysconfdir}/init/webvirtmgr.conf
mkdir -p %{buildroot}%{_sysconfdir}/init.d
cp conf/initd/webvirtmgr-console-redhat %{buildroot}%{_sysconfdir}/init.d/webvirtmgr-console
%endif
cp manage.py %{buildroot}%{python_sitelib}/%{name}/
rm -rf %{buildroot}%{_bindir}/manage.py
%post
%if %{with systemd}
%systemd_post webvirtmgr.service
%systemd_post webvirtmgr-console.service
%else
/sbin/chkconfig --add webvirtmgr
/sbin/chkconfig --add webvirtmgr-console
%endif
%preun
%if %{with systemd}
%systemd_preun webvirtmgr.service
%systemd_preun webvirtmgr-console.service
%else
if [ $1 -eq 0 ]; then
/sbin/stop webvirtmgr >/dev/null 2>&1 || :
/sbin/chkconfig --del webvirtmgr
/sbin/service webvirtmgr stop >/dev/null 2>&1 || :
/sbin/chkconfig --del webvirtmgr-console
fi
%endif
%postun
%if %{with systemd}
%systemd_postun_with_restart webvirtmgr.service
%systemd_postun_with_restart webvirtmgr-console.service
%else
if [ $1 -ge 1 ]; then
/sbin/restart webvirtmgr >/dev/null 2>&1 || :
/sbin/service webvirtmgr-console restart >/dev/null 2>&1 || :
fi
%endif
%files
%defattr(-,root,root)
%{python_sitelib}/*
%config %{python_sitelib}/%{name}/conf/gunicorn.conf.py
%if %{with systemd}
%{_unitdir}/webvirtmgr.service
%{_unitdir}/webvirtmgr-console.service
%else
%{_sysconfdir}/init/*
%{_sysconfdir}/init.d/*
%endif
%changelog
* Mon Jan 18 2016 Giacomo Sanchietti <giacomo.sanchietti@nethesis.it> - 4.8.9
- Support rhel 7
- Upgrade to 4.8.9
* Wed Jan 26 2015 Edoardo Spadoni <edoardo.spadoni@nethesis.it> - 4.8.8
- first version