Fixed empty line handling process_config.sh

This commit fixed empty line handling in the config file for being able to used KConfig-based defconfigs with the empty lines in them
This commit is contained in:
Valentyn Korniienko
2025-05-02 09:27:44 -03:00
committed by Alan C. Assis
parent 2b513af2c3
commit 43b29a0547
+9 -3
View File
@@ -56,9 +56,15 @@ process_file() {
exit 1
fi
else
local key_config="$(echo "$line" | cut -d= -f1)="
sed -i.backup "/$key_config/d" $output_file
echo "$line" >> $output_file
if [[ -n "$line" ]]; then
local key_config="$(echo "$line" | cut -d= -f1)="
sed -i.backup "/^$key_config/d" "$output_file"
echo "$line" >> "$output_file"
echo "Appended $line to $output_file"
else
echo "The empty line from defconfig was skipped from adding to $output_file"
fi
fi
done < "$input_file"
}