-
Notifications
You must be signed in to change notification settings - Fork 128
/
snapper.spec.in
389 lines (342 loc) · 11.4 KB
/
snapper.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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
#
# spec file for package snapper
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
# Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
%define _fillupdir /var/adm/fillup-templates
%endif
# Location for PAM module
%if 0%{?suse_version} >= 1550
%define pam_security_dir %{_libdir}/security
%else
%define pam_security_dir /%{_lib}/security
%endif
# Optionally build without SELinux support
%bcond_without selinux
# Optionally build with test coverage reporting
%bcond_with coverage
Name: snapper
Version: @VERSION@
Release: 0
Summary: Tool for filesystem snapshot management
License: GPL-2.0-only
Group: System/Packages
URL: http://snapper.io/
Source: snapper-%{version}.tar.xz
%if 0%{?suse_version}
BuildRequires: libboost_system-devel
BuildRequires: libboost_thread-devel
BuildRequires: libboost_test-devel
%else
BuildRequires: boost-devel
%endif
BuildRequires: gcc-c++
BuildRequires: libacl-devel
BuildRequires: libtool
BuildRequires: libxml2-devel
BuildRequires: e2fsprogs-devel
BuildRequires: ncurses-devel
%if 0%{?suse_version}
BuildRequires: libbtrfs-devel
%endif
%if 0%{?suse_version} >= 1550
BuildRequires: libbtrfsutil-devel
%endif
%if 0%{?suse_version}
BuildRequires: libmount-devel >= 2.24
%endif
%if 0%{?fedora_version}
BuildRequires: pkgconfig
BuildRequires: systemd
%else
BuildRequires: pkg-config
%endif
%if 0%{?fedora_version} || 0%{?centos_version}
BuildRequires: glibc-langpack-de
BuildRequires: glibc-langpack-fr
BuildRequires: glibc-langpack-en
%else
BuildRequires: glibc-locale
%endif
%if ! 0%{?mandriva_version}
%if 0%{?fedora_version}
BuildRequires: dbus-devel
BuildRequires: docbook-style-xsl
%else
BuildRequires: dbus-1-devel
BuildRequires: docbook-xsl-stylesheets
%endif
BuildRequires: libxslt
%else
BuildRequires: docbook-dtd45-xml
BuildRequires: docbook-xsl
BuildRequires: libdbus-1-devel
BuildRequires: xsltproc
%endif
%if 0%{?suse_version}
BuildRequires: libzypp(plugin:commit)
%endif
BuildRequires: pam-devel
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version}
BuildRequires: json-c-devel
%else
BuildRequires: libjson-c-devel
%endif
%if %{with selinux}
BuildRequires: libselinux-devel
%endif
BuildRequires: zlib-devel
%if %{with coverage}
BuildRequires: lcov
%endif
Requires: diffutils
Requires: libsnapper@LIBVERSION_MAJOR@ = %version
Requires: systemd
%if 0%{?suse_version}
Recommends: logrotate snapper-zypp-plugin
Supplements: btrfsprogs
%endif
%description
This package contains snapper, a tool for filesystem snapshot management.
%prep
%setup -q
%build
%if %{with coverage}
# optimized code may confuse the coverage measurement, turn it off
# -fPIC is mysteriously needed on Fedora.
export CFLAGS="-g3 -fPIC"
export CXXFLAGS="-g3 -fPIC"
%else
export CFLAGS="%{optflags} -DNDEBUG"
export CXXFLAGS="%{optflags} -DNDEBUG"
%endif
autoreconf -fvi
%configure \
--docdir="%{_defaultdocdir}/snapper" \
%{?with_coverage:--enable-coverage} \
--with-pam-security="%{pam_security_dir}" \
%if ! 0%{?suse_version}
--disable-rollback \
--disable-btrfs-quota \
%endif
%{?with_selinux:--enable-selinux} \
--disable-silent-rules --disable-bcachefs --disable-ext4
make %{?_smp_mflags}
%install
%make_install
rm -f "%{buildroot}/%{_libdir}"/*.la "%{buildroot}/%{pam_security_dir}/pam_snapper.la"
rm -f %{buildroot}/etc/cron.hourly/suse.de-snapper
%if 0%{?suse_version}
install -D -m 644 data/sysconfig.snapper "%{buildroot}%{_fillupdir}/sysconfig.snapper"
%else
install -D -m 644 data/sysconfig.snapper "%{buildroot}/etc/sysconfig/snapper"
%endif
# move logrotate files from /etc/logrotate.d to /usr/etc/logrotate.d
%if 0%{?suse_version} > 1500
mkdir -p %{buildroot}%{_distconfdir}/logrotate.d
mv %{buildroot}/%{_sysconfdir}/logrotate.d/snapper %{buildroot}%{_distconfdir}/logrotate.d
%endif
%{find_lang} snapper
%check
make %{?_smp_mflags} check VERBOSE=1
%pre
%if 0%{?suse_version}
%service_add_pre snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%if 0%{?suse_version} > 1500
# Migration from /etc/logrotate.d to /usr/etc/logrotate.d
test -f /etc/logrotate.d/snapper.rpmsave && mv -v /etc/logrotate.d/snapper.rpmsave /etc/logrotate.d/snapper.rpmsave.old ||:
%endif
%post
%if 0%{?suse_version}
# special hack, since the macros were added much later than
# the systemd timer
if [ -f /etc/cron.hourly/suse.de-snapper ]; then
systemctl preset snapper-timeline.timer || :
systemctl is-enabled -q snapper-timeline.timer && systemctl start snapper-timeline.timer || :
fi
%service_add_post snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%if 0%{?suse_version} > 1500
%posttrans
# Migration from /etc/logrotate.d to /usr/etc/logrotate.d
test -f /etc/logrotate.d/snapper.rpmsave && mv -v /etc/logrotate.d/snapper.rpmsave /etc/logrotate.d/snapper ||:
%endif
%preun
%if 0%{?suse_version}
%service_del_preun snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%postun
%if 0%{?suse_version}
%service_del_postun snapper-boot.service snapper-boot.timer snapper-cleanup.service snapper-cleanup.timer snapper-timeline.service snapper-timeline.timer snapperd.service
%endif
%files -f snapper.lang
%defattr(-,root,root)
%{_bindir}/snapper
%{_sbindir}/snapperd
%if 0%{?suse_version}
%{_sbindir}/mksubvolume
%endif
%dir %{_prefix}/lib/snapper
%{_prefix}/lib/snapper/*-helper
%{_mandir}/*/snapper.8*
%{_mandir}/*/snapperd.8*
%{_mandir}/*/snapper-configs.5*
%if 0%{?suse_version}
%doc %{_mandir}/*/mksubvolume.8*
%endif
%if 0%{?suse_version} > 1500
%{_distconfdir}/logrotate.d/snapper
%else
%config(noreplace) %{_sysconfdir}/logrotate.d/snapper
%endif
%{_unitdir}/snapper-{timeline,cleanup,boot}.*
%{_unitdir}/snapperd.service
%if 0%{?suse_version} <= 1500
%dir %{_datadir}/dbus-1/system.d
%endif
%{_datadir}/dbus-1/system.d/org.opensuse.Snapper.conf
%{_datadir}/dbus-1/system-services/org.opensuse.Snapper.service
%{_datadir}/bash-completion
%{_datadir}/zsh
%package -n libsnapper@LIBVERSION_MAJOR@
Summary: Library for filesystem snapshot management
Group: System/Libraries
Requires: util-linux
%if 0%{?suse_version}
PreReq: %fillup_prereq
%endif
# expands to Obsoletes: libsnapper1 libsnapper2 libsnapper3...
Obsoletes: %(echo `seq -s " " -f "libsnapper%.f" $((@LIBVERSION_MAJOR@ - 1))`)
%description -n libsnapper@LIBVERSION_MAJOR@
This package contains libsnapper, a library for filesystem snapshot management.
%files -n libsnapper@LIBVERSION_MAJOR@
%license %{_defaultdocdir}/snapper/COPYING
%doc %dir %{_defaultdocdir}/snapper
%doc %{_defaultdocdir}/snapper/AUTHORS
%{_libdir}/libsnapper.so.*
%dir %{_sysconfdir}/snapper
%dir %{_sysconfdir}/snapper/configs
%dir %{_datadir}/snapper
%dir %{_datadir}/snapper/config-templates
%{_datadir}/snapper/config-templates/default
%dir %{_datadir}/snapper/filters
%{_datadir}/snapper/filters/*.txt
%if 0%{?suse_version}
%{_fillupdir}/sysconfig.snapper
%else
%config(noreplace) %{_sysconfdir}/sysconfig/snapper
%endif
%dir /usr/lib/snapper/plugins
%pre -n libsnapper@LIBVERSION_MAJOR@
# Migration from /etc/snapper to /usr/share/snapper
for i in config-templates/default filters/base.txt filters/lvm.txt filters/x11.txt ; do
test -f /etc/snapper/${i}.rpmsave && mv -v /etc/snapper/${i}.rpmsave /etc/snapper/${i}.rpmsave.old ||:
done
%posttrans -n libsnapper@LIBVERSION_MAJOR@
# Migration from /etc/snapper to /usr/share/snapper
for i in config-templates/default filters/base.txt filters/lvm.txt filters/x11.txt ; do
test -f /etc/snapper/${i}.rpmsave && mv -v /etc/snapper/${i}.rpmsave /etc/snapper/${i} ||:
done
%post -n libsnapper@LIBVERSION_MAJOR@
/sbin/ldconfig
%if 0%{?suse_version}
%{fillup_only -n snapper}
%endif
%postun -n libsnapper@LIBVERSION_MAJOR@ -p /sbin/ldconfig
%package -n libsnapper-devel
%if 0%{?suse_version}
Requires: libboost_headers-devel
%else
Requires: boost-devel
%endif
Requires: gcc-c++
Requires: libacl-devel
Requires: libsnapper@LIBVERSION_MAJOR@ = %version
Requires: libstdc++-devel
Requires: libxml2-devel
%if 0%{?suse_version}
Requires: libbtrfs-devel
%endif
%if 0%{?suse_version}
Requires: libmount-devel >= 2.24
%endif
Summary: Header files and documentation for libsnapper
Group: Development/Languages/C and C++
%description -n libsnapper-devel
This package contains header files and documentation for developing with
libsnapper.
%files -n libsnapper-devel
%{_libdir}/libsnapper.so
%{_includedir}/snapper
%package -n snapper-zypp-plugin
Requires: libzypp(plugin:commit) = 1
Requires: snapper = %version
Summary: A zypp commit plugin for calling snapper
Group: System/Packages
%description -n snapper-zypp-plugin
This package contains a plugin for zypp that makes filesystem snapshots with
snapper during commits.
%files -n snapper-zypp-plugin
%{_datadir}/snapper/zypp-plugin.conf
/usr/lib/zypp/plugins/commit/snapper-zypp-plugin
%doc %{_mandir}/*/snapper-zypp-plugin.8*
%doc %{_mandir}/*/snapper-zypp-plugin.conf.5*
%pre -n snapper-zypp-plugin
# Migration from /etc/snapper to /usr/share/snapper
for i in zypp-plugin.conf ; do
test -f /etc/snapper/${i}.rpmsave && mv -v /etc/snapper/${i}.rpmsave /etc/snapper/${i}.rpmsave.old ||:
done
%posttrans -n snapper-zypp-plugin
# Migration from /etc/snapper to /usr/share/snapper
for i in zypp-plugin.conf ; do
test -f /etc/snapper/${i}.rpmsave && mv -v /etc/snapper/${i}.rpmsave /etc/snapper/${i} ||:
done
%package -n snapper-backup
Requires: snapper = %version
Summary: A backup program for snapper
Group: System/Packages
%description -n snapper-backup
A backup program for snapshots created by snapper.
%files -n snapper-backup
%{_sbindir}/snbk
%dir %{_sysconfdir}/snapper/backup-configs
%dir %{_sysconfdir}/snapper/certs
%{_unitdir}/snapper-{backup}.*
%{_mandir}/*/snbk.8*
%{_mandir}/*/snapper-backup-configs.5*
%package -n pam_snapper
Requires: pam
Requires: snapper = %version
Summary: PAM module for calling snapper
Requires: util-linux-systemd
Group: System/Packages
%description -n pam_snapper
A PAM module for calling snapper during user login and logout.
%files -n pam_snapper
/%{pam_security_dir}/pam_snapper.so
%dir /usr/lib/pam_snapper
/usr/lib/pam_snapper/*.sh
%doc %{_mandir}/*/pam_snapper.8*
%package testsuite
Summary: Integration tests for snapper
Group: System/Packages
%description testsuite
Tests to be run in a scratch machine to test that snapper operates as expected.
%files testsuite
%dir %{_libdir}/snapper
%dir %{_libdir}/snapper/testsuite
%{_libdir}/snapper/testsuite/*
%changelog