-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtendrl-selinux.spec
161 lines (126 loc) · 4.98 KB
/
tendrl-selinux.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
# defining macros needed by SELinux
%global selinuxtype targeted
%global selinux_policyver 3.13.1-166
%global moduletype services
%global modulenames tendrl carbon collectd grafana
# Usage: _format var format
# Expand 'modulenames' into various formats as needed
# Format must contain '$x' somewhere to do anything useful
%global _format() export %1=""; for x in %{modulenames}; do %1+=%2; %1+=" "; done;
Name: tendrl-selinux
Version: 1.5.4
Release: 2%{?dist}
Summary: SELinux policy for Tendrl
License: LGPLv2.1
Url: https://github.com/Tendrl/tendrl-selinux
Source0: %{name}-%{version}.tar.gz
BuildArch: noarch
Requires: selinux-policy >= %{selinux_policyver}
BuildRequires: git
BuildRequires: bzip2
BuildRequires: pkgconfig(systemd)
BuildRequires: selinux-policy
BuildRequires: selinux-policy-devel
Requires(post): selinux-policy-base >= %{selinux_policyver}
Requires(post): libselinux-utils
Requires(post): policycoreutils
Requires(post): policycoreutils-python
%description
SELinux policy module for Tendrl.
%package -n carbon-selinux
Summary: SELinux policy for Carbon
Requires: selinux-policy >= %{selinux_policyver}
Requires(post): selinux-policy-base >= %{selinux_policyver}
Requires(post): libselinux-utils
Requires(post): policycoreutils
Requires(post): policycoreutils-python
%description -n carbon-selinux
SELinux policy module for Carbon.
%package -n tendrl-collectd-selinux
Summary: SELinux policy for Tendrl Collectd
Requires: selinux-policy >= %{selinux_policyver}
Requires(post): selinux-policy-base >= %{selinux_policyver}
Requires(post): libselinux-utils
Requires(post): policycoreutils
Requires(post): policycoreutils-python
%description -n tendrl-collectd-selinux
SELinux policy module for Tendrl Collectd.
%package -n tendrl-grafana-selinux
Summary: SELinux policy for Tendrl Grafana
Requires: selinux-policy >= %{selinux_policyver}
Requires(post): selinux-policy-base >= %{selinux_policyver}
Requires(post): libselinux-utils
Requires(post): policycoreutils
Requires(post): policycoreutils-python
%description -n tendrl-grafana-selinux
SELinux policy module for Tendrl Grafana.
%prep
%setup -q
%build
make DATADIR="%{_datadir}" TARGETS="%{modulenames}" modules
%pre
%selinux_relabel_pre -s %{selinuxtype}
%install
# Create directories where SELinux polies will be installed
install -d %{buildroot}%{_datadir}/selinux/packages
install -d -p %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
install -d -p %{buildroot}%{_pkgdocdir}/
# Install SELinux interfaces
%_format INTERFACES $x.if
install -p -m 644 $INTERFACES %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
# Install policy modules
%_format MODULES $x.pp.bz2
install -m 0644 $MODULES %{buildroot}%{_datadir}/selinux/packages
# Install readme and license files
install -p -m 644 README.md %{buildroot}%{_pkgdocdir}/README.md
install -p -m 644 LICENSE %{buildroot}%{_pkgdocdir}/LICENSE
%check
%post
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/tendrl.pp.bz2
%post -n carbon-selinux
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/carbon.pp.bz2
%post -n tendrl-collectd-selinux
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/collectd.pp.bz2
%post -n tendrl-grafana-selinux
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/grafana.pp.bz2
%postun
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} tendrl
fi
%postun -n carbon-selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} carbon
fi
%postun -n tendrl-collectd-selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} collectd
fi
%postun -n tendrl-grafana-selinux
if [ $1 -eq 0 ]; then
%selinux_modules_uninstall -s %{selinuxtype} grafana
fi
%posttrans
%selinux_relabel_post -s %{selinuxtype}
%files
%defattr(-,root,root,0755)
%attr(0644,root,root) %{_datadir}/selinux/packages/tendrl.pp.bz2
%attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/tendrl.if
# readme and license files
%doc %{_pkgdocdir}/README.md
%license %{_pkgdocdir}/LICENSE
%files -n carbon-selinux
%attr(0644,root,root) %{_datadir}/selinux/packages/carbon.pp.bz2
%attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/carbon.if
%files -n tendrl-collectd-selinux
%attr(0644,root,root) %{_datadir}/selinux/packages/collectd.pp.bz2
%attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/collectd.if
%files -n tendrl-grafana-selinux
%attr(0644,root,root) %{_datadir}/selinux/packages/grafana.pp.bz2
%attr(0644,root,root) %{_datadir}/selinux/devel/include/%{moduletype}/grafana.if
%changelog
* Mon Dec 11 2017 Rohan Kanade <rkanade@redhat.com> - 1.5.4-2
- Fix /var/log/tendrl/* perms
* Fri Nov 24 2017 Rohan Kanade <rkanade@redhat.com> - 1.5.4-1
- tendrl-selinux 1.5.4
* Thu Oct 12 2017 Martin Bukatovič <mbukatov@redhat.com> - 1.5.3-1
- First build of Tendrl SELinux policies