Gentoo Archives: gentoo-commits

From: Michael Palimaka <kensington@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/apparmor/, sys-apps/apparmor/files/
Date: Thu, 07 Dec 2017 09:49:31
Message-Id: 1512640141.01417d76965fc9cb35171e72694562c71da537c5.kensington@gentoo
commit:     01417d76965fc9cb35171e72694562c71da537c5
Author:     Reuben D'Netto <rdnetto <AT> gmail <DOT> com>
AuthorDate: Wed Dec  6 11:12:46 2017 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Thu Dec  7 09:49:01 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01417d76

sys-apps/apparmor: Added systemd unit.

Closes: https://bugs.gentoo.org/555388
Closes: https://github.com/gentoo/gentoo/pull/6466

 sys-apps/apparmor/Manifest                  |  2 +-
 sys-apps/apparmor/apparmor-2.11.1-r2.ebuild | 64 +++++++++++++++++++++++++++++
 sys-apps/apparmor/files/apparmor.service    | 14 +++++++
 sys-apps/apparmor/files/apparmor_load.sh    |  2 +
 sys-apps/apparmor/files/apparmor_unload.sh  |  2 +
 5 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/sys-apps/apparmor/Manifest b/sys-apps/apparmor/Manifest
index a2e9f8fdb80..fa2e8344639 100644
--- a/sys-apps/apparmor/Manifest
+++ b/sys-apps/apparmor/Manifest
@@ -1 +1 @@
-DIST apparmor-2.11.1.tar.gz 5017646 SHA256 e8e2b22c18e6b6741c1f96942398923b97316b53d86408629f922d5689ec3507 SHA512 f088157cc116987e56c0e02127497b1ec6241f3d761ec3b53211fa188f5f02c9408d6b903f2d275328ede88ebfd1393e00aad9f68cbe78fa9ab3711ba0f9c00c WHIRLPOOL 46553fd18fbee79b3553bdeb2745c4d29396da0077284eda7391c7d94ff930f06242e295006d16110df12ae927d2b7ace0277769e61848d3f8670cebdd9d8c9e
+DIST apparmor-2.11.1.tar.gz 5017646 BLAKE2B ee0176c87b2800eb562c136ff324f08e444c412117c4593ff97c4b0e4c63db2aea0721c6ed38f3c733e3c95024165f329e520acf838c4798a8285b8dedf0d51e SHA512 f088157cc116987e56c0e02127497b1ec6241f3d761ec3b53211fa188f5f02c9408d6b903f2d275328ede88ebfd1393e00aad9f68cbe78fa9ab3711ba0f9c00c

diff --git a/sys-apps/apparmor/apparmor-2.11.1-r2.ebuild b/sys-apps/apparmor/apparmor-2.11.1-r2.ebuild
new file mode 100644
index 00000000000..1d78904b577
--- /dev/null
+++ b/sys-apps/apparmor/apparmor-2.11.1-r2.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit systemd toolchain-funcs versionator
+
+MY_PV="$(get_version_component_range 1-2)"
+
+DESCRIPTION="Userspace utils and init scripts for the AppArmor application security system"
+HOMEPAGE="http://apparmor.net/"
+SRC_URI="https://launchpad.net/${PN}/${MY_PV}/${PV}/+download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="doc"
+
+RDEPEND="~sys-libs/libapparmor-${PV}"
+DEPEND="${RDEPEND}
+	dev-lang/perl
+	sys-devel/bison
+	sys-devel/flex
+	doc? ( dev-tex/latex2html )
+"
+
+S=${WORKDIR}/apparmor-${PV}/parser
+
+PATCHES=(
+	"${FILESDIR}/${PN}-2.10-makefile.patch"
+	"${FILESDIR}/${PN}-2.11.1-dynamic-link.patch"
+)
+
+src_prepare() {
+	default
+
+	# remove warning about missing file that controls features
+	# we don't currently support
+	sed -e "/installation problem/ctrue" -i rc.apparmor.functions || die
+}
+
+src_compile()  {
+	emake CC="$(tc-getCC)" CXX="$(tc-getCXX)" USE_SYSTEM=1 arch manpages
+	use doc && emake pdf
+}
+
+src_test() {
+	emake CXX="$(tc-getCXX)" USE_SYSTEM=1 check
+}
+
+src_install() {
+	emake DESTDIR="${D}" DISTRO="unknown" USE_SYSTEM=1 install
+
+	dodir /etc/apparmor.d/disable
+
+	newinitd "${FILESDIR}/${PN}-init" ${PN}
+	systemd_newunit "${FILESDIR}/apparmor.service" apparmor.service
+
+	use doc && dodoc techdoc.pdf
+
+	exeinto /usr/share/apparmor
+	doexe "${FILESDIR}/apparmor_load.sh"
+	doexe "${FILESDIR}/apparmor_unload.sh"
+}

diff --git a/sys-apps/apparmor/files/apparmor.service b/sys-apps/apparmor/files/apparmor.service
new file mode 100644
index 00000000000..89f14fed4b7
--- /dev/null
+++ b/sys-apps/apparmor/files/apparmor.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=AppArmor profiles
+DefaultDependencies=no
+After=local-fs.target
+Before=sysinit.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/share/apparmor/apparmor_load.sh
+ExecStop=/usr/share/apparmor/apparmor_unload.sh
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target

diff --git a/sys-apps/apparmor/files/apparmor_load.sh b/sys-apps/apparmor/files/apparmor_load.sh
new file mode 100755
index 00000000000..e6fe6b68431
--- /dev/null
+++ b/sys-apps/apparmor/files/apparmor_load.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+find "/etc/apparmor.d/" -maxdepth 1 -type f -exec apparmor_parser -r {} +

diff --git a/sys-apps/apparmor/files/apparmor_unload.sh b/sys-apps/apparmor/files/apparmor_unload.sh
new file mode 100755
index 00000000000..19e598bb84c
--- /dev/null
+++ b/sys-apps/apparmor/files/apparmor_unload.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+find "/etc/apparmor.d/" -maxdepth 1 -type f -exec apparmor_parser -R {} \;