[pkg-apparmor] [apparmor-profiles-extra] 01/02: Add a script allowing the source package to put specific profiles in complain mode.

Intrigeri intrigeri at moszumanska.debian.org
Mon Jul 3 09:37:48 UTC 2017


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch master
in repository apparmor-profiles-extra.

commit a495b510f242211a9f775d89744ade811ed0b4fe
Author: intrigeri <intrigeri at boum.org>
Date:   Mon Jul 3 09:36:13 2017 +0000

    Add a script allowing the source package to put specific profiles in complain mode.
---
 debian/scripts/put-profile-in-complain-mode | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/debian/scripts/put-profile-in-complain-mode b/debian/scripts/put-profile-in-complain-mode
new file mode 100755
index 0000000..fc2cefa
--- /dev/null
+++ b/debian/scripts/put-profile-in-complain-mode
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+set -u
+set -x
+
+[ $# -eq 1 ] || exit 1
+
+PROFILE="$1"
+[ -n "$PROFILE" ] || exit 2
+[ -f "$PROFILE" ] || exit 3
+
+if egrep -q 'flags=\(.*\) {' "$PROFILE"; then
+    # Deal with existing flags, but need to account for multiple
+    # profiles in one file and not all of them having the same
+    # flags.
+    grep -q 'flags=(complain)' "$PROFILE" && continue
+    sed -i -e 's/flags=(\(.*\)) {$/flags=(complain,\1) {/' -e 's/ {$/ flags=(complain) {/' -e 's/) flags=(complain) {/) {/' "$PROFILE"
+else
+   # No existing flags
+   sed -i 's/ {$/ flags=(complain) {/' "$PROFILE"
+fi

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/apparmor-profiles-extra.git



More information about the pkg-apparmor-team mailing list