blob: d78fd7e13a8e45bc881acb64f56d4e0d989f89f9 (
plain)
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
|
# RHEL 9 does not include pytest-mock.
%bcond_with tests
%global with_selinux 1
%global selinuxtype targeted
%global modulename efsutils
%global watchdog_service_name amazon-efs-mount-watchdog
Name: efs-utils
Version: 1.35.1
Release: 7%{?dist}
Summary: Utilities for Amazon Elastic File System (EFS)
License: MIT
URL: https://github.com/aws/efs-utils
Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz
Source1: efsutils.te
Source2: efsutils.if
Source3: efsutils.fc
Source4: efsutils_selinux.8
# Patch a deprecation warning to avoid having it fill the logs.
# https://github.com/aws/efs-utils/pull/189
Patch: fix-deprecation-warning.patch
BuildArch: noarch
Requires: nfs-utils
Requires: openssl
Requires: stunnel
Requires: util-linux
Requires: which
Requires: python3dist(botocore)
%if 0%{?with_selinux}
Requires: (%{name}-selinux if selinux-policy-%{selinuxtype})
%endif
BuildRequires: python3-devel
BuildRequires: systemd-rpm-macros
%if %{with tests}
BuildRequires: python3dist(botocore)
BuildRequires: python3dist(pytest)
BuildRequires: python3dist(pytest-mock)
%endif
%global _description %{expand:
Utilities for Amazon Elastic File System (EFS).}
%description %{_description}
%if 0%{?with_selinux}
# SELinux subpackage
%package selinux
Summary: %{name} SELinux policy
Requires: %{name} = %{version}-%{release}
Requires: selinux-policy-%{selinuxtype}
Requires(post): selinux-policy-%{selinuxtype}
BuildRequires: selinux-policy-devel
%{?selinux_requires}
%description selinux
Custom %{name} SELinux policy module
%endif
%prep
%autosetup -n %{name}-%{version} -p1
# Use unittest.mock for testing.
sed -i 's/from mock/from unittest.mock/' test/common.py
%build
echo "Nothing to build"
# Disable the automatic version checking.
sed -i 's/enable_version_check = true/enable_version_check = false/' dist/efs-utils.conf
%if 0%{?with_selinux}
mkdir selinux
cp -p %{SOURCE1} selinux/
cp -p %{SOURCE2} selinux/
cp -p %{SOURCE3} selinux/
cp -p %{SOURCE4} selinux/
%make_build -f %{_datadir}/selinux/devel/Makefile %{modulename}.pp
bzip2 -9 %{modulename}.pp
%endif
%install
# Watchdog service unit file.
install -m 0755 -vd %{buildroot}%{_unitdir}
install -vp -m 644 dist/%{watchdog_service_name}.service %{buildroot}%{_unitdir}/
# Watchdog service itself.
install -m 0755 -vd %{buildroot}%{_bindir}
install -vp -m 755 src/watchdog/__init__.py %{buildroot}%{_bindir}/amazon-efs-mount-watchdog
# Configuration files and Amazon root certificates.
install -m 0755 -vd %{buildroot}%{_sysconfdir}/amazon/efs/
install -vp -m 644 dist/%{name}.conf %{buildroot}%{_sysconfdir}/amazon/efs/
install -vp -m 444 dist/%{name}.crt %{buildroot}%{_sysconfdir}/amazon/efs/
# mount.efs script allows mounting EFS file systems by their short name.
install -m 0755 -vd %{buildroot}%{_sbindir}
install -vp -m 755 src/mount_efs/__init__.py %{buildroot}%{_sbindir}/mount.efs
# Man page.
install -m 0755 -vd %{buildroot}%{_mandir}/man8/
install -vp -m 644 man/mount.efs.8 %{buildroot}%{_mandir}/man8/
# Log directory.
install -m 0755 -vd %{buildroot}%{_localstatedir}/log/amazon/efs
%if 0%{?with_selinux}
install -D -m 0644 -t %{buildroot}%{_mandir}/man8 selinux/%{modulename}_selinux.8
install -D -m 0644 %{modulename}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2
install -D -p -m 0644 selinux/%{modulename}.if %{buildroot}%{_datadir}/selinux/devel/include/distributed/%{modulename}.if
%endif
%if %{with tests}
%check
# Avoid running tests with coverage enabled.
touch pytest.ini
# Ignore some tests that require networking and get stuck forever.
# Also skip a broken version check test: https://github.com/aws/efs-utils/issues/194
PYTHONPATH=$(pwd)/src %pytest \
--ignore test/mount_efs_test/test_main.py \
--ignore test/mount_efs_test/test_bootstrap_tls.py \
--ignore test/mount_efs_test/test_create_self_signed_cert.py \
--ignore test/watchdog_test/test_refresh_self_signed_certificate.py \
-k "not test_version_check_ready"
%endif
########################################################################################
#
# BEGIN SELINUX PRE/POST
#
# SELinux contexts are saved so that only affected files can be
# relabeled after the policy module installation
%if 0%{?with_selinux}
%pre selinux
%selinux_relabel_pre -s %{selinuxtype}
%post selinux
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2
%selinux_relabel_post -s %{selinuxtype}
if [ "$1" -le "1" ]; then # First install
%systemd_postun_with_restart %{watchdog_service_name}.service
fi
%postun selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} %{modulename}
%selinux_relabel_post -s %{selinuxtype}
%systemd_postun_with_restart %{watchdog_service_name}.service
fi
%endif
########################################################################################
%files -n %{name}
%license LICENSE
%doc CONTRIBUTING.md README.md
%dir /var/log/amazon/efs
%dir %{_sysconfdir}/amazon
%dir %{_sysconfdir}/amazon/efs
%config(noreplace) %{_sysconfdir}/amazon/efs/efs-utils.conf
%{_unitdir}/%{watchdog_service_name}.service
%{_sysconfdir}/amazon/efs/efs-utils.crt
%{_sbindir}/mount.efs
%{_bindir}/amazon-efs-mount-watchdog
%{_mandir}/man8/mount.efs.8*
%if 0%{?with_selinux}
%files selinux
%{_mandir}/man8/%{modulename}_selinux.8.*
%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.*
%{_datadir}/selinux/devel/include/distributed/%{modulename}.if
%ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename}
%endif
%post
%systemd_post %{watchdog_service_name}.service
%preun
%systemd_preun %{watchdog_service_name}.service
%postun
%systemd_postun_with_restart %{watchdog_service_name}.service
%changelog
* Fri Jan 19 2024 Felix Kolwa <fkolwa@redhat.com> - 1.35.1-7
- Bump revision number to 7.
- Pull in changes from Major Hayden:
- Skip version check test
Opened upstream bug:
https://github.com/aws/efs-utils/issues/194
- Disable automatic version check
* Mon Jan 08 2024 Felix Kolwa <fkolwa@redhat.com> - 1.35.0-6
- Bump revision number to 6.
* Thu Dec 07 2023 Felix Kolwa <fkolwa@redhat.com> - 1.35.0-5
- Bump release to 5 to include selinux-policy-targeted-38.1.28-1 release.
* Fri Nov 17 2023 fkolwa <fkolwa@redhat.com> - 1.35.0-4
- Refactor watchdog service name
* Wed Nov 15 2023 Major Hayden <major@redhat.com> - 1.35.0-3
- Added deprecation warning patch.
- Added SELinux policies. (RHEL-14154)
* Tue Oct 10 2023 Major Hayden <major@redhat.com> - 1.35.0-2
- Add patch for ignoring the fsap option.
* Tue Sep 05 2023 Major Hayden <major@redhat.com> - 1.31.38-1
- Initial package for version 1.31.38
|