From 5697c3b7e4ece610e71117f1dddb2cc8637f8420 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Tue, 15 Jun 2010 18:16:37 +0200 Subject: hook-functions: replace awk calls with sed in dep_add_modules() If mawk is installed as default awk version it won't handle [:digit:], instead let's replace the grep/awk/shell version with one single sed invocation. Closes: #585991 Thanks: Thorsten Glaser Signed-off-by: Michael Prokop --- hook-functions | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'hook-functions') diff --git a/hook-functions b/hook-functions index ffb6a67..1a0e097 100644 --- a/hook-functions +++ b/hook-functions @@ -273,9 +273,7 @@ dep_add_modules() done # lvm on md or luks on md if [ "${block#md}" != "${block}" ]; then - block=$(grep "^${block}" /proc/mdstat | \ - awk "{gsub(/^${block} : .* (multipath|linear|raid[[:digit:]]+)\ /,\"\")};1") - block="${block%%\[*}" + block=$(sed -ne 's/multipath/[/' -e 's/linear/[/' -e 's/raid[0-9][0-9]*/[/' -e 's/\([hs]d[a-z][a-z]*\)[0-9][0-9]*/\1/g' -e '/^'${block}' :/s/^[^[]*\[ \([^\[]*\)\[.*$/\1/p'