aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Oltean <olteanv@gmail.com>2019-01-19 00:44:07 +0200
committerMichael Bestas <mkbestas@lineageos.org>2019-03-03 16:42:24 +0200
commit5238ba8fe5a5a89fba4f89e639223f114ba25240 (patch)
tree775620514a94e37cfabc659a0bd7dcef23c7ac2c
parentbec92ebaec8c0094d71ddaa7091b3259b9fe5415 (diff)
downloadvendor_lineage-5238ba8fe5a5a89fba4f89e639223f114ba25240.tar.gz
vendor_lineage-5238ba8fe5a5a89fba4f89e639223f114ba25240.tar.bz2
vendor_lineage-5238ba8fe5a5a89fba4f89e639223f114ba25240.zip
extract_utils: make --section match words anywhere in the line
Change-Id: Ia3fe2160f0f4bc7da1b5bd31a21080af51b41fab Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
-rw-r--r--build/tools/extract_utils.sh6
1 files changed, 5 insertions, 1 deletions
diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh
index ac03200c..143ff2ee 100644
--- a/build/tools/extract_utils.sh
+++ b/build/tools/extract_utils.sh
@@ -662,7 +662,11 @@ function parse_file_list() {
if [ -n "$2" ]; then
echo "Using section \"$2\""
LIST=$TMPDIR/files.txt
- cat $1 | sed -n '/# '"$2"'/I,/^\s*$/p' > $LIST
+ # Match all lines starting with first line found to start* with '#'
+ # comment and contain** $2, and ending with first line to be empty*.
+ # *whitespaces (tabs, spaces) at the beginning of lines are discarded
+ # **the $2 match is case-insensitive
+ cat $1 | sed -n '/^[[:space:]]*#.*'"$2"'/I,/^[[:space:]]*$/ p' > $LIST
else
LIST=$1
fi