%global selinux_variants mls targeted %global modulename tor-exec-transport Name: tor-exec-transport-selinux Version: 1.1 Release: 1%{?dist} Summary: SELinux policy for tor pluggable transport plugins License: BSD URL: http://hedayatvk.wordpress.com Source0: %{modulename}.te BuildRequires: checkpolicy, selinux-policy-devel, hardlink %if "%{_selinux_policy_version}" != "" Requires: selinux-policy >= %{_selinux_policy_version} %endif Requires(post): /usr/sbin/semodule Requires(postun): /usr/sbin/semodule %description %{summary} %prep rm -rf SELinux mkdir SELinux cp -p %{SOURCE0} SELinux %build cd SELinux for selinuxvariant in %{selinux_variants} do make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile mv %{modulename}.pp %{modulename}.pp.${selinuxvariant} make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean done cd - %install cd SELinux for selinuxvariant in %{selinux_variants} do install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} install -p -m 644 %{modulename}.pp.${selinuxvariant} \ %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp done cd - /usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux %post for selinuxvariant in %{selinux_variants} do /usr/sbin/semodule -s ${selinuxvariant} -i \ %{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || : done %postun if [ $1 -eq 0 ] ; then for selinuxvariant in %{selinux_variants} do /usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || : done fi %files %doc SELinux/*.te %{_datadir}/selinux/*/%{modulename}.pp %changelog * Sat Sep 30 2017 Hedayat Vatankhah - 1.0-1 - Initial version