diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-04-22 19:34:28 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-04-22 19:34:28 +0100 |
commit | 9e9bed4ca47561f956808f356f850fa38ed7269e (patch) | |
tree | f5dae6be42034aa9f031c8bfe80c33c969bf0446 /sys-apps/apparmor/files/apparmor-init | |
parent | f55f93498c7c0f16aa038a4fa01cb41fd01712cd (diff) |
sys-apps/apparmor : import from gentoo, cherry-pick CAPS fix (https://gitlab.com/apparmor/apparmor/-/commit/e92da079ca12e776991bd36524430bd67c1cb72a)
Diffstat (limited to 'sys-apps/apparmor/files/apparmor-init')
-rw-r--r-- | sys-apps/apparmor/files/apparmor-init | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/sys-apps/apparmor/files/apparmor-init b/sys-apps/apparmor/files/apparmor-init new file mode 100644 index 00000000..48877e4b --- /dev/null +++ b/sys-apps/apparmor/files/apparmor-init @@ -0,0 +1,91 @@ +#!/sbin/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/libexec/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 +} |