Commit 00837cef authored by ssrq's avatar ssrq Committed by ssrq

[type/__easy_rsa_pki] Support leading whitespace in vars file

parent 5e83d7ed
......@@ -16,32 +16,32 @@ BEGIN {
edits_allowed {
line = $0
sub(/^#*[ \t]*/, "", line)
sub(/^[ \t]*#*[ \t]*/, "", line)
split(line, toks)
# toks[i] = { "set_var", key, ... }
if (toks[1] == "set_var") {
varname = toks[2]
if (/^#/) {
if ($1 ~ /^#/) {
# keep comments
print
}
if ((varname in should)) {
# replace line with value from should
printf "set_var %s %s\n", varname, should[varname]
printf "set_var %s\t%s\n", varname, should[varname]
delete should[varname]
} else {
# drop it
}
next # do not print line below
next # do not print set_var line below
}
}
{ print }
END {
for (k in should) {
printf "set_var %s %s\n", k, should[k]
for (varname in should) {
printf "set_var %s\t%s\n", varname, should[varname]
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment