Skip to content

Commit

Permalink
Change AWK script to handle awkward name and attrs fields in partitio…
Browse files Browse the repository at this point in the history
…n layouts we created ourselves.
  • Loading branch information
Sebastian-Roth committed Oct 9, 2021
1 parent 75a4245 commit 9dfde4a
Showing 1 changed file with 18 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -697,20 +697,31 @@ BEGIN {
testfield1 = fields[5];
testfield2 = fields[5];
namefield = gsub(/.*name= */, "", testfield1);
attrsfield = gsub(/.*attrs=*/, "", testfield2);
attrsfield = gsub(/.*attrs= */, "", testfield2);
if (namefield > 0) {
# Checking for corrupted name field, e.g. name="attrs=\x22RequiredPartition GUID:63"
testnameattrs = fields[5];
nameattrsfield = gsub(/.*attrs= */, "", testnameattrs);
gsub(/.*name= */, "", fields[5]);
partitions[part_name, "name"] = fields[5];
}
if (attrsfield > 0) {
gsub(/.*attrs=*/, "", fields[5]);
if (nameattrsfield > 0) {
attrs_special_char = gsub(/.*\\x22 */, "\"", testnameattrs);
partitions[part_name, "attrs"] = testnameattrs;
}
else {
partitions[part_name, "name"] = fields[5];
}
} else if (attrsfield > 0) {
gsub(/.*attrs= */, "", fields[5]);
partitions[part_name, "attrs"] = fields[5];
}
# Get attrs value
if (fields[6]) {
gsub(/.*attrs= */, "", fields[6]);
# Sets the attrs int the object.
partitions[part_name, "attrs"] = fields[6];
# Only set attrs when it's not being set by fields[5] before or if it's different to that
if (partitions[part_name, "attrs"] == "" || partitions[part_name, "attrs"] != fields[6]) {
# Sets the attrs in the object.
partitions[part_name, "attrs"] = fields[6];
}
}
} else {
split($0, typeList, "Id=");
Expand Down

0 comments on commit 9dfde4a

Please sign in to comment.