From 4684549f124a3409620fe19b5ee214b6c85d138a Mon Sep 17 00:00:00 2001 From: David P Date: Tue, 19 Jul 2022 16:03:48 -0400 Subject: addpkg: nonsystemd/apparmor-openrc 20210506-1 Signed-off-by: David P --- nonsystemd/apparmor-openrc/PKGBUILD | 19 +++++++ nonsystemd/apparmor-openrc/apparmor.initd | 91 +++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 nonsystemd/apparmor-openrc/PKGBUILD create mode 100644 nonsystemd/apparmor-openrc/apparmor.initd diff --git a/nonsystemd/apparmor-openrc/PKGBUILD b/nonsystemd/apparmor-openrc/PKGBUILD new file mode 100644 index 000000000..fb6229c98 --- /dev/null +++ b/nonsystemd/apparmor-openrc/PKGBUILD @@ -0,0 +1,19 @@ +# Maintainer: artoo + +pkgname=apparmor-openrc +pkgver=20210506 +pkgrel=1 +pkgdesc="OpenRC apparmor init script" +arch=('any') +url="https://gitea.artixlinux.org/artixlinux/packages-openrc" +license=('GPL2') +groups=('openrc-world') +provides=('init-apparmor') +depends=('openrc' 'apparmor') +conflicts=('init-apparmor') +source=("apparmor.initd") +sha256sums=('ba7601a738761a3f27278a7508ae32463f7097c597f0806931983ef6af2a5d3a') + +package() { + install -Dm755 "${srcdir}"/apparmor.initd "${pkgdir}"/etc/init.d/apparmor +} diff --git a/nonsystemd/apparmor-openrc/apparmor.initd b/nonsystemd/apparmor-openrc/apparmor.initd new file mode 100644 index 000000000..773aa5347 --- /dev/null +++ b/nonsystemd/apparmor-openrc/apparmor.initd @@ -0,0 +1,91 @@ +#!/usr/bin/openrc-run +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Load all configured profiles for the AppArmor security module." +description_reload="Reload all profiles" + +extra_started_commands="reload" + +aa_action() { + local arg=$1 + local return + + shift + $* + return=$? + + if [ ${return} -eq 0 ]; then + aa_log_success_msg $arg + else + aa_log_failure_msg arg + fi + + return $return +} + +aa_log_action_start() { + ebegin $1 +} + +aa_log_action_end() { + eend $1 +} + +aa_log_success_msg() { + einfo $1 +} + +aa_log_warning_msg() { + ewarn $1 +} + +aa_log_failure_msg() { + eerror $1 +} + +aa_log_skipped_msg() { + einfo $1 +} + +aa_log_daemon_msg() { + einfo $1 +} + +aa_log_end_msg() { + eend $1 +} + +. /usr/lib/apparmor/rc.apparmor.functions + +start() { + ebegin "Starting AppArmor" + eindent + + if ! is_apparmor_loaded ; then + load_module + if [ $? -ne 0 ]; then + eerror "AppArmor kernel support is not present" + eend 1 + return 1 + fi + fi + + parse_profiles load + + eoutdent +} + +stop() { + ebegin "Stopping AppArmor" + eindent + apparmor_stop + eoutdent +} + +reload() { + # todo: split out clean_profiles into its own function upstream + # so we can do parse_profiles reload && clean_profiles + # and do a proper reload instead of restart + apparmor_restart +} -- cgit v1.2.3