diff options
author | allgdante <allan.garret@gmail.com> | 2018-01-26 11:09:38 +0100 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2018-03-13 15:33:55 +0000 |
commit | ad8994e692705cfffed1c2ec14070b7b6ce85de9 (patch) | |
tree | ff3d65b3bd20a240e4c370239e3b9a86afcdf96c /testing/apparmor/apparmor.initd | |
parent | eec0dec579994a499def4c1ab349672b8404b80b (diff) | |
download | aports-ad8994e692705cfffed1c2ec14070b7b6ce85de9.tar.bz2 aports-ad8994e692705cfffed1c2ec14070b7b6ce85de9.tar.xz |
testing/apparmor: upgrade to 2.12
Diffstat (limited to 'testing/apparmor/apparmor.initd')
-rw-r--r-- | testing/apparmor/apparmor.initd | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/testing/apparmor/apparmor.initd b/testing/apparmor/apparmor.initd new file mode 100644 index 0000000000..15058f2895 --- /dev/null +++ b/testing/apparmor/apparmor.initd @@ -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/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 +} |