public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/ejabberd] f45: Refactor to use Fedora SELinux macros.
@ 2026-09-23 19:07 Randy Barlow
  0 siblings, 0 replies; only message in thread
From: Randy Barlow @ 2026-09-23 19:07 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/ejabberd
            Branch : f45
            Commit : f0e0ee4f685c055397109b589d7e9a2772916904
            Author : Randy Barlow <randy@electronsweatshop.com>
            Date   : 2018-09-15T19:14:04-04:00
            Stats  : +35/-21 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/ejabberd/c/f0e0ee4f685c055397109b589d7e9a2772916904?branch=f45

            Log:
            Refactor to use Fedora SELinux macros.

The macros are documented at
https://fedoraproject.org/wiki/SELinux/IndependentPolicy.

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>

---
diff --git a/ejabberd.spec b/ejabberd.spec
index 9dff6e0..6216a06 100644
--- a/ejabberd.spec
+++ b/ejabberd.spec
@@ -21,10 +21,16 @@
 %global stun_ver 1.0.23
 %global xmpp_ver 1.2.1
 
+# Define SELinux policy variables
+%global selinuxtype targeted
+%global selinux_policyver 3.14.2
+%global moduletype contrib
+%global modulename ejabberd
+
 
 Name:           ejabberd
 Version:        18.06
-Release:        2%{?dist}
+Release:        3%{?dist}
 BuildArch:      noarch
 
 License:        GPLv2+
@@ -150,11 +156,11 @@ BuildArch: noarch
 
 Summary: SELinux policy for ejabberd
 
-Requires: selinux-policy
-Requires: selinux-policy-targeted
-Requires(post): /usr/sbin/selinuxenabled
-Requires(post): /usr/sbin/semodule
-Requires(posttrans): /usr/sbin/restorecon
+Requires: selinux-policy >= %{selinux_policyver}
+Requires(post): selinux-policy-base >= %{selinux_policyver}
+Requires(post): libselinux-utils
+Requires(post): policycoreutils
+Requires(post): policycoreutils-python-utils
 
 
 %description selinux
@@ -193,6 +199,7 @@ autoreconf -ivf
 
 # Build the SELinux policy
 make NAME=ejabberd -f /usr/share/selinux/devel/Makefile DISTRO=fedora%{fedora}
+bzip2 ejabberd.pp
 
 
 %install
@@ -252,11 +259,11 @@ install -D -p -m 0644 %{S:12} %{buildroot}%{_datadir}/polkit-1/actions/ejabberdc
 install -D -p -m 0644 %{S:13} %{buildroot}%{_datadir}/polkit-1/rules.d/51-ejabberdctl.rules
 
 # Install the SELinux policy
-install -d  %{buildroot}%{_datadir}/selinux/targeted
-install -d %{buildroot}%{_datadir}/selinux/devel/include/apps
+install -d %{buildroot}%{_datadir}/selinux/packages
+install -d -p %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
 
-install -p -m 0644 ejabberd.pp %{buildroot}%{_datadir}/selinux/targeted/
-install -p -m 0644 ejabberd.if %{buildroot}%{_datadir}/selinux/devel/include/apps/
+install -p -m 0644 ejabberd.if %{buildroot}%{_datadir}/selinux/devel/include/%{moduletype}
+install -p -m 0644 ejabberd.pp.bz2 %{buildroot}%{_datadir}/selinux/packages
 
 
 %check
@@ -300,6 +307,10 @@ if [ $1 -gt 1 ]; then
 fi
 
 
+%pre selinux
+%selinux_relabel_pre -s %{selinuxtype}
+
+
 %post
 %systemd_post %{name}.service
 
@@ -326,30 +337,29 @@ fi)
 
 
 %post selinux
-if /usr/sbin/selinuxenabled ; then
-/usr/sbin/semodule -i %{_datadir}/selinux/targeted/ejabberd.pp
-fi
+%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{modulename}.pp.bz2
 
 
 %posttrans selinux
 /usr/sbin/restorecon -i -R /var/lib/ejabberd/
 /usr/sbin/restorecon -i -R /var/log/ejabberd/
+%selinux_relabel_post -s %{selinuxtype}
 
 
 %preun
 %systemd_preun %{name}.service
 
 
-%preun selinux
-if [ $1 -eq 0 ] && [ "$(/usr/sbin/semodule -l | grep ejabberd)" = "ejabberd" ]; then
-    /usr/sbin/semodule -s targeted -r ejabberd &> /dev/null
-fi
-
-
 %postun
 %systemd_postun_with_restart %{name}.service
 
 
+%postun selinux
+if [ $1 -eq 0 ]; then
+    %selinux_modules_uninstall -s %{selinuxtype} %{modulename}
+fi
+
+
 %files
 %license COPYING
 %doc README README.md
@@ -388,11 +398,15 @@ fi
 
 
 %files selinux
-%{_datadir}/selinux/devel/include/apps/ejabberd.if
-%{_datadir}/selinux/targeted/ejabberd.pp
+%{_datadir}/selinux/devel/include/%{moduletype}/ejabberd.if
+%{_datadir}/selinux/packages/ejabberd.pp.bz2
 
 
 %changelog
+* Thu Sep 06 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 18.06-3
+- Refactor to use Fedora SELinux macros documented at
+  https://fedoraproject.org/wiki/SELinux/IndependentPolicy.
+
 * Fri Aug 31 2018 Randy Barlow <bowlofeggs@fedoraproject.org> - 18.06-2
 - Use erl and epmd symlinks from bindir instead of trying to use the archful ones (#1573006).
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-23 19:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-23 19:07 [rpms/ejabberd] f45: Refactor to use Fedora SELinux macros Randy Barlow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox