-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclownfish.spec.in
201 lines (174 loc) · 5.53 KB
/
clownfish.spec.in
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
# CLOWNFISH specfile
# RHEL >= 7 comes with systemd
%if 0%{?rhel} >= 7
%define with_systemd 1
%endif
Name: @PACKAGE@
Version: @VERSION@
Prefix: %{_prefix}
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
Release: @CLOWNFISH_RELEASE@%{?dist}
Summary: clownfish - Lustre Management Utilities
License: MIT
Group: Applications/System
Source0: @PACKAGE@-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires: clownfish-pylcommon = %{version}-%{release}
Requires: rsync
Provides: clownfish = %{version}-%{release}
%if %{with systemd}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%endif
%description
Clownfish management system of Lustre file system.
%package pylcommon
Summary: Python Library of Lustre - General Python Library to manage Lustre
Provides: clownfish-pylcommon = %{version}-%{release}
Requires: python-prettytable
Group: Applications/System
%description pylcommon
Pylustre is a python library for managing Lustre file system.
%package clownfish
Summary: Lustre Management System
Requires: clownfish-pylcommon = %{version}-%{release}
Requires: rsync
Provides: clownfish = %{version}-%{release}
Group: Applications/System
%description clownfish
Clownfish manages Lustre clusters for HA purposes.
%package pyltest
Summary: Python Library of clownfish common test framework
Requires: clownfish-pylcommon = %{version}-%{release}
Provides: clownfish-pyltest = %{version}-%{release}
%if %{with systemd}
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
BuildRequires: systemd
%endif
Group: Applications/System
%description pyltest
Pyltest is a common test framework for clownfish
%post pyltest
if [[ %{release} == *.el7 ]];then
# explicit systemctl daemon-reload
/usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
else
/sbin/service ltest_scheduler reload >/dev/null 2>&1 ||:
fi
%preun pyltest
if [ $1 = 0 ] ; then
if [[ %{release} == *.el7 ]];then
# Disable and stop on removal.
/usr/bin/systemctl --no-reload disable ltest_scheduler > /dev/null 2>&1 || :
/usr/bin/systemctl stop ltest_scheduler > /dev/null 2>&1 || :
else
/sbin/service ltest_scheduler stop >/dev/null 2>&1 ||:
/sbin/chkconfig --del ltest_scheduler
fi
fi
%postun pyltest
if [ $1 = 1 ] ; then
if [[ %{release} == *.el7 ]];then
# Restart on upgrade
/usr/bin/systemctl try-restart ltest_scheduler > /dev/null 2>&1 || :
else
/sbin/service ltest_scheduler condrestart >/dev/null 2>&1 ||:
fi
fi
Generated using options: @ac_configure_args@
%prep
%setup -q -n @PACKAGE@-%{version}
%build
./configure @ac_configure_args@ %{?configure_flags:configure_flags} \
--sysconfdir=%{_sysconfdir} \
--mandir=%{_mandir} \
--libdir=%{_libdir} \
--includedir=%{_includedir} \
--prefix=%{_prefix}
make
make check
find pyclownfish pylcommon pyltest -maxdepth 1 -type f -a ! -name "*.py" | xargs rm -f
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_libdir}/clownfish
mkdir -p $RPM_BUILD_ROOT%{python_sitelib}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/yum.repos.d
mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
cp clf \
clf_local \
clownfish_install \
clownfish_server \
clownfish_test \
ltest_console \
ltest_launch \
ltest_scheduler \
lvirt \
$RPM_BUILD_ROOT%{_bindir}
cp -a pyclownfish $RPM_BUILD_ROOT%{python_sitelib}
cp -a pylcommon $RPM_BUILD_ROOT%{python_sitelib}
cp -a pyltest $RPM_BUILD_ROOT%{python_sitelib}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}
cp -a \
example_configs/clownfish/clownfish_test.conf \
example_configs/clownfish/seperate_mgs/clownfish.conf \
example_configs/ltest/ltest_scheduler.conf \
example_configs/clownfish/seperate_mgs/lvirt.conf \
$RPM_BUILD_ROOT%{_sysconfdir}
%if %{with systemd}
mkdir -p $RPM_BUILD_ROOT/usr/lib/systemd/system/
install -m 0644 -D systemd/clownfish_server.service \
$RPM_BUILD_ROOT%{_unitdir}/clownfish_server.service
install -m 0644 -D systemd/ltest_scheduler.service \
$RPM_BUILD_ROOT%{_unitdir}/ltest_scheduler.service
%else
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
install -m 0744 -D init.d/ltest_scheduler \
$RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/ltest_scheduler
install -m 0744 -D init.d/clownfish_server \
$RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/clownfish_server
%endif
install -g 0 -o 0 -m 0644 man/clf.1 $RPM_BUILD_ROOT%{_mandir}/man1/
mkdir -p $RPM_BUILD_ROOT/%{_usr}/lib/ocf/resource.d/clownfish
cp -a ocf/* $RPM_BUILD_ROOT/%{_usr}/lib/ocf/resource.d/clownfish
%clean
rm -rf $RPM_BUILD_ROOT
%files
%{python_sitelib}/pyclownfish
%{_bindir}/clf
%{_bindir}/clf_local
%{_bindir}/clownfish_install
%{_bindir}/clownfish_server
%{_bindir}/clownfish_test
%config(noreplace) %{_sysconfdir}/clownfish.conf
%config(noreplace) %{_sysconfdir}/clownfish_test.conf
%if %{with systemd}
%{_unitdir}/clownfish_server.service
%else
%{_sysconfdir}/rc.d/init.d/clownfish_server
%endif
%{_mandir}/man1/clf.1*
%{_usr}/lib/ocf/resource.d/clownfish/*
%files pylcommon
%{python_sitelib}/pylcommon
%{_bindir}/lvirt
%config(noreplace) %{_sysconfdir}/lvirt.conf
%files pyltest
%{python_sitelib}/pyltest
%{_bindir}/ltest_console
%{_bindir}/ltest_launch
%{_bindir}/ltest_scheduler
%config(noreplace) %{_sysconfdir}/ltest_scheduler.conf
%if %{with systemd}
%{_unitdir}/ltest_scheduler.service
%else
%{_sysconfdir}/rc.d/init.d/ltest_scheduler
%endif
%changelog
* Fri Mar 29 2019 Li Xi <lixi@ddn.com> 1.0
- Original version