__lxc_container: no grep ERE used, switching to BRE

When checking for lxc configuration that should be removed, it says to
grep to use extended regular expressions (ERE). But there are no
characters not covered by basic regular expressions (BRE). So switching
to to BRE, as it may not match user input as regex.
This commit is contained in:
matze 2020-10-20 17:03:14 +02:00
commit 4e06ea7816

View file

@ -207,10 +207,10 @@ DONE
# check if smth. to be deleted
# must be before adding, because it takes the content of the original file
# because 'cat $file > $file' will not work (> opens before command reads it)
# will create extended regex pattern for grep with malformed spaces
# will create a basic regex pattern for grep to ignore malformed spaces
if [ -s "$__object/files/config.del" ]; then
cat <<DONE
grep -v -E -f - <<'ABSENT' "$container_config" > "\$tmpconfig"
grep -v -f - <<'ABSENT' "$container_config" > "\$tmpconfig"
$(awk -v FS=' = ' -v OFS=' = ' -v blank='[[:blank:]]*' '
function ntostring(n) { ret=""; for(i=n; i<=NF; i++) ret=ret $i (i<NF ? OFS : ""); return ret }
{ printf "^%s%s%s=%s%s%s$%s", blank, $1, blank, blank, ntostring(2), blank, ORS }