File sasl-xoauth2-selinux.spec of Package sasl-xoauth2-selinux

# defining macros needed by SELinux
%global selinuxtype targeted
%global modulename sasl-xoauth2

Name:           sasl-xoauth2-selinux
Version:        0.1.0
Release:        0
Summary:        SELinux policies for sasl-xoauth2

License:        GPL-2.0-only
URL:            https://build.opensuse.org/package/show/home:S520/%{name}
Source0:        sasl-xoauth2.te
Source1:        sasl-xoauth2.fc
Source2:        LICENSE

BuildArch:      noarch
BuildRequires:  selinux-policy-devel
BuildRequires:  selinux-policy-%{selinuxtype}
%{?selinux_requires}
Requires:       selinux-policy-%{selinuxtype}
Requires(post): selinux-policy-%{selinuxtype}

%description
SELinux policy modules for sasl-xoauth2.

%prep
install %{SOURCE0} .
install %{SOURCE1} .
install %{SOURCE2} .

%build
make -f %{_datadir}/selinux/devel/Makefile %{modulename}.pp
bzip2 -9 %{modulename}.pp

%pre
%selinux_relabel_pre -s %{selinuxtype}

%install
# install policy modules
install -D -m 0644 %{modulename}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2

%check

%post
%selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2

%postun
if [ $1 -eq 0 ]; then
    %selinux_modules_uninstall -s %{selinuxtype} %{modulename}
fi

%posttrans
%selinux_relabel_post -s %{selinuxtype}

%files
%license LICENSE
%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.*
%ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename}

%changelog
openSUSE Build Service is sponsored by