diff --git a/debian/scripts/put-profile-in-complain-mode b/debian/scripts/put-profile-in-complain-mode new file mode 100755 index 0000000000000000000000000000000000000000..fc2cefa816a0a18f83e08950e9c31695e8121b58 --- /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