build: make the complain mode faster to enable.
This commit is contained in:
parent
a432d656c8
commit
cc7dd22244
1 changed files with 27 additions and 6 deletions
33
configure
vendored
33
configure
vendored
|
|
@ -112,18 +112,39 @@ flags() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set complain flag on all profile (Dev only)
|
# Internal complain process
|
||||||
complain() {
|
_complain() {
|
||||||
_msg "Set complain flag on all profiles"
|
local start="$1" end="$2"; shift 2
|
||||||
for path in "${ROOT:?}/apparmor.d/"*; do
|
files=("$@")
|
||||||
[[ -d "$path" ]] && continue
|
ii="$start"
|
||||||
|
while [[ $ii -le $end && $ii -lt $len ]]; do
|
||||||
|
path="${files[$ii]}"
|
||||||
|
(( ii = ii + 1 ))
|
||||||
|
[[ -f "$path" ]] || continue
|
||||||
flags="$(grep -o -m 1 'flags=(.*)' "$path" | cut -d '(' -f2 | cut -d ')' -f1)"
|
flags="$(grep -o -m 1 'flags=(.*)' "$path" | cut -d '(' -f2 | cut -d ')' -f1)"
|
||||||
[[ "$flags" =~ complain ]] && continue
|
[[ "$flags" =~ complain ]] && continue
|
||||||
echo -n .
|
|
||||||
sed -e "s/flags=(.*)//" \
|
sed -e "s/flags=(.*)//" \
|
||||||
-e "s/ {$/ flags=(complain $flags) {/" \
|
-e "s/ {$/ flags=(complain $flags) {/" \
|
||||||
-i "$path"
|
-i "$path"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# Set complain flag on all profile (Dev only)
|
||||||
|
complain() {
|
||||||
|
local len nprof nproc
|
||||||
|
_msg "Set complain flag on all profiles"
|
||||||
|
mapfile -t files < <(find "${ROOT:?}/apparmor.d" -type f)
|
||||||
|
len="${#files[@]}"
|
||||||
|
nproc=$(nproc)
|
||||||
|
(( nprof = len/nproc + 1 ))
|
||||||
|
start=0
|
||||||
|
end=$nprof
|
||||||
|
for ((ii = 0 ; ii < nproc ; ii++)); do
|
||||||
|
_complain $start $end "${files[@]}" &
|
||||||
|
(( start = end + 1 ))
|
||||||
|
(( end = end + nprof ))
|
||||||
|
done
|
||||||
|
wait
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue