-
Notifications
You must be signed in to change notification settings - Fork 1
/
redhawk-adminservice.spec
201 lines (176 loc) · 7.67 KB
/
redhawk-adminservice.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#
# This file is protected by Copyright. Please refer to the COPYRIGHT file
# distributed with this source distribution.
#
# This file is part of REDHAWK core.
#
# REDHAWK core is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# REDHAWK core is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
# details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
%if 0%{?fedora} >= 17 || 0%{?rhel} >=7
%global with_systemd 1
%endif
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?_ossiehome: %define _ossiehome /usr/local/redhawk/core}
%define _prefix %{_ossiehome}
Prefix: %{_prefix}
Name: redhawk-adminservice
Version: 2.2.8
Release: 1%{?dist}
Summary: Redhawk Admin Service
Group: Applications/Engineering
License: LGPLv3+
URL: http://redhawksdr.org/
Source: %{name}-%{version}.tar.gz
Vendor: REDHAWK
BuildArch: noarch
Requires: python
Requires: redhawk >= 2.0
Requires(pre): redhawk >= 2.0
Requires: python-meld3
Requires: python-tornado
Requires: python-zmq
BuildRequires: python-setuptools
BuildRequires: python-devel >= 2.4
%if 0%{?with_systemd}
%{?systemd_requires}
BuildRequires: systemd
Requires: systemd
Requires(pre): systemd
%else
Requires: initscripts
Requires(pre): initscripts
Requires: chkconfig
%endif
# Turn off the brp-python-bytecompile script; our setup.py does byte compilation
# (From https://fedoraproject.org/wiki/Packaging:Python#Bytecompiling_with_the_correct_python_version)
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
%description
REDHAWK Admin Service
* Commit: __REVISION__
* Source Date/Time: __DATETIME__
%prep
%if 0%{?_localbuild}
%setup -q -n adminservice
%else
%setup -q
%endif
%build
%{__python} setup.py build
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install --skip-build -O1 --home=%{_prefix} --root=%{buildroot}
install -d -m 0775 $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/domains.d
install -d -m 0775 $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/extras.d
install -d -m 0775 $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/init.d
install -d -m 0775 $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/nodes.d
install -d -m 0775 $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/waveforms.d
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/log/redhawk
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/log/redhawk/device-mgrs
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/log/redhawk/domain-mgrs
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/log/redhawk/waveforms
%{__cp} -r etc $RPM_BUILD_ROOT/
%{__mv} $RPM_BUILD_ROOT/%{_sysconfdir}/redhawk/cron.d $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d
%{__cp} -r bin/* $RPM_BUILD_ROOT/%{_bindir}
%if 0%{?with_systemd}
%{__mkdir_p} $RPM_BUILD_ROOT%{_unitdir}
%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/systemd/redhawk-adminservice-setup $RPM_BUILD_ROOT%{_bindir}
%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/systemd/redhawk-adminservice.service $RPM_BUILD_ROOT%{_unitdir}
%{__mv} $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/systemd/redhawk-adminservice-setup.service $RPM_BUILD_ROOT%{_unitdir}
%else
rm -f $RPM_BUILD_ROOT/%{_bindir}/adminserviced-start
rm -f $RPM_BUILD_ROOT/%{_bindir}/adminserviced-stop
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/run/redhawk
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/run/redhawk/device-mgrs
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/run/redhawk/domain-mgrs
install -d -m 0775 $RPM_BUILD_ROOT%{_localstatedir}/run/redhawk/waveforms
%endif
rm -r $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/systemd
echo "ENABLED=1" > $RPM_BUILD_ROOT%{_sysconfdir}/redhawk/rh.cond.cfg
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_bindir}/adminserviced
%{_bindir}/rhadmin
%config %attr(660,root,redhawk) %{_sysconfdir}/redhawk/adminserviced.conf
%config %attr(664,root,redhawk) %{_sysconfdir}/redhawk/rh.cond.cfg
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/domains.d
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/extras.d
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/nodes.d
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/waveforms.d
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/init.d
%config %attr(664,root,redhawk) %{_sysconfdir}/redhawk/init.d/adminserviced.defaults
%config %attr(664,root,redhawk) %{_sysconfdir}/redhawk/init.d/domain.defaults
%config %attr(664,root,redhawk) %{_sysconfdir}/redhawk/init.d/node.defaults
%config %attr(664,root,redhawk) %{_sysconfdir}/redhawk/init.d/waveform.defaults
%attr(775,root,redhawk) %{_sysconfdir}/redhawk/init.d/redhawk-adminservice
%attr(775,root,redhawk) %{_sysconfdir}/redhawk/init.d/redhawk-wf-control
%attr(644,root,redhawk) %{_sysconfdir}/cron.d/redhawk
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/logging
%attr(664,root,redhawk) %{_sysconfdir}/redhawk/logging/default.logging.properties
%attr(664,root,redhawk) %{_sysconfdir}/redhawk/logging/example.logging.properties
%attr(664,root,redhawk) %{_sysconfdir}/redhawk/logging/logrotate.redhawk
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/security
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/security/limits.d
%attr(664,root,redhawk) %{_sysconfdir}/redhawk/security/limits.d/99-redhawk-limits.conf
%dir %attr(775,root,redhawk) %{_sysconfdir}/redhawk/sysctl.d
%attr(664,root,redhawk) %{_sysconfdir}/redhawk/sysctl.d/sysctl.conf
%dir %attr(775,root,redhawk) %{_localstatedir}/log/redhawk
%dir %attr(775,root,redhawk) %{_localstatedir}/log/redhawk/device-mgrs
%dir %attr(775,root,redhawk) %{_localstatedir}/log/redhawk/domain-mgrs
%dir %attr(775,root,redhawk) %{_localstatedir}/log/redhawk/waveforms
%{_prefix}/lib/python/adminservice
%if 0%{?rhel} >= 6
%{_prefix}/lib/python/adminservice-%{version}-py%{python_version}.egg-info
%endif
%if 0%{?with_systemd}
%{_bindir}/adminserviced-start
%{_bindir}/adminserviced-stop
%{_bindir}/redhawk-adminservice-setup
%{_unitdir}/redhawk-adminservice.service
%{_unitdir}/redhawk-adminservice-setup.service
%else
%dir %attr(775,root,redhawk) %{_localstatedir}/run/redhawk
%dir %attr(775,root,redhawk) %{_localstatedir}/run/redhawk/device-mgrs
%dir %attr(775,root,redhawk) %{_localstatedir}/run/redhawk/domain-mgrs
%dir %attr(775,root,redhawk) %{_localstatedir}/run/redhawk/waveforms
%endif
%post
%if 0%{?with_systemd}
%systemd_post redhawk-adminservice-setup.service
%systemd_post redhawk-adminservice.service
systemctl reload crond > /dev/null 2>&1 || :
%else
ln -s %{_sysconfdir}/redhawk/init.d/redhawk-adminservice %{_initddir}
/sbin/chkconfig --add redhawk-adminservice
service crond reload > /dev/null 2>&1 || :
%endif
%preun
%if 0%{?with_systemd}
%systemd_preun redhawk-adminservice.service
%systemd_preun redhawk-adminservice-setup.service
%else
/sbin/service redhawk-adminservice stop > /dev/null 2>&1 || :
/sbin/chkconfig --del redhawk-adminservice > /dev/null 2>&1 || :
%endif
%postun
%if 0%{?with_systemd}
%systemd_postun_with_restart redhawk-adminservice.service
%systemd_postun_with_restart redhawk-adminservice-setup.service
systemctl reload crond > /dev/null 2>&1 || :
%else
[ -h %{_initddir}/redhawk-adminservice ] && rm -f %{_initddir}/redhawk-adminservice
/sbin/service crond reload > /dev/null 2>&1 || :
%endif
%changelog