Template
Add template elements
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
# defining macros needed by SELinux
|
||||
%global selinuxtype targeted
|
||||
%global modulename ${REPO_NAME}
|
||||
|
||||
Name: ${REPO_NAME}-selinux
|
||||
Version: 0.1.0
|
||||
Release: %autorelease
|
||||
License: GPLv3
|
||||
URL: ${REPO_HTTPS_URL}
|
||||
Summary: SELinux policy for ${REPO_NAME}
|
||||
Source0: # archive with SELinux policy sources. e.g: myapp-selinux.tar
|
||||
Requires: selinux-policy-%{selinuxtype}
|
||||
Requires(post): selinux-policy-%{selinuxtype}
|
||||
BuildRequires: selinux-policy-devel
|
||||
BuildArch: noarch
|
||||
%{?selinux_requires}
|
||||
%description
|
||||
Custom SELinux policy modules for ${REPO_NAME}.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
make
|
||||
|
||||
%install
|
||||
# install policy modules
|
||||
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
|
||||
%check
|
||||
|
||||
%pre
|
||||
%selinux_relabel_pre -s %{selinuxtype}
|
||||
|
||||
%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
|
||||
%{_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}
|
||||
%license LICENCE
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
@@ -0,0 +1 @@
|
||||
## <summary>policy for ${REPO_NAME}</summary>
|
||||
@@ -0,0 +1,12 @@
|
||||
policy_module(${REPO_NAME}, 1.0.0)
|
||||
|
||||
########################################
|
||||
#
|
||||
# Declarations
|
||||
#
|
||||
|
||||
|
||||
########################################
|
||||
#
|
||||
# ${REPO_NAME} local policy
|
||||
#
|
||||
@@ -0,0 +1,27 @@
|
||||
TARGET?=${REPO_NAME}
|
||||
MODULES?=$${TARGET:=.pp.bz2}
|
||||
SHAREDIR?=/usr/share
|
||||
SELINUXTYPE?=targeted
|
||||
|
||||
all: $${TARGET:=.pp.bz2}
|
||||
|
||||
%.pp.bz2: %.pp
|
||||
@echo Compressing $^ -\> $@
|
||||
bzip2 -9 $^
|
||||
|
||||
%.pp: %.te
|
||||
make -f $${SHAREDIR}/selinux/devel/Makefile $@
|
||||
|
||||
clean:
|
||||
rm -f *~ *.tc *.pp *.pp.bz2
|
||||
rm -rf tmp *.tar.gz
|
||||
|
||||
man: install-policy
|
||||
sepolicy manpage --path . --domain $${TARGET}_t
|
||||
|
||||
install-policy: all
|
||||
semodule -i $${TARGET}.pp.bz2
|
||||
|
||||
install: man
|
||||
install -D -m 644 $${TARGET}.pp.bz2 $${DESTDIR}$${SHAREDIR}/selinux/packages/$${SELINUXTYPE}/$${TARGET}.pp.bz2
|
||||
install -D -m 644 $${TARGET}_selinux.8 $${DESTDIR}$${SHAREDIR}/man/man8/
|
||||
Reference in New Issue
Block a user