From fdb3d52d59acf4dc2bb877184b28c75030df83fe Mon Sep 17 00:00:00 2001 From: Michael Ploujnikov Date: Mon, 8 Jun 2009 11:17:29 -0400 Subject: [PATCH] use a variable to hold the regex single quote regexps in variables to make it work with bash-3.1 --- dracut-functions | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dracut-functions b/dracut-functions index 97de9b4e..d4caacfe 100755 --- a/dracut-functions +++ b/dracut-functions @@ -107,11 +107,13 @@ inst_binary() { derror "dracut cannot create an initrd." exit 1 fi - [[ $line =~ ([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*) ]] || continue + so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)' + [[ $line =~ $so_regex ]] || continue FILE=${BASH_REMATCH[1]} [[ -f ${initdir}$FILE ]] && continue # see if we are loading an optimized version of a shared lib. - if [[ $FILE =~ ^(/lib[^/]*).* ]]; then + lib_regex='^(/lib[^/]*).*' + if [[ $FILE =~ $lib_regex ]]; then TLIBDIR=${BASH_REMATCH[1]} BASE="${FILE##*/}" # prefer nosegneg libs, then unoptimized ones. @@ -137,7 +139,8 @@ inst_script() { read -r -n 80 line <"$1" # If debug is set, clean unprintable chars to prevent messing up the term [[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]') - [[ $line =~ (#! *)(/[^ ]+).* ]] || return 1 + shebang_regex='(#! *)(/[^ ]+).*' + [[ $line =~ $shebang_regex ]] || return 1 inst "${BASH_REMATCH[2]}" && inst_simple "$@" } -- 2.11.4.GIT