From a495b510f242211a9f775d89744ade811ed0b4fe Mon Sep 17 00:00:00 2001
From: intrigeri <intrigeri@boum.org>
Date: Mon, 3 Jul 2017 09:36:13 +0000
Subject: [PATCH] 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(+)
 create mode 100755 debian/scripts/put-profile-in-complain-mode

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
-- 
GitLab