]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Make bash regexes behave
authorSeewer Philippe <philippe.seewer-omB+W0Dpw2o@public.gmane.org>
Fri, 27 Feb 2009 14:16:36 +0000 (15:16 +0100)
committerHarald Hoyer <harald@redhat.com>
Wed, 4 Mar 2009 16:07:46 +0000 (17:07 +0100)
On some systems with newer or unpatched bash versions the whole right
portion of =~ is considered part of the regex. Means we need to get rid
of enclosing ''.

This patch fixes this.

--
  dracut-functions |    8 ++++----
  1 files changed, 4 insertions(+), 4 deletions(-)

dracut-functions

index 7bb042f51615305d84525f2a93b143d76a99b843..cd1af8e1193afbf9665ce74a3cb2a04e494c52b2 100755 (executable)
@@ -83,17 +83,17 @@ inst_binary() {
     # I love bash!
     while read line; do
        [[ $line = 'not a dynamic executable' ]] && return 1
-       [[ $line =~ 'not found' ]] &&{
+       [[ $line =~ not\ found ]] &&{
            echo "Missing a shared library required by $bin." >&2
            echo "Run \"ldd $bin\" to find out what it is." >&2
            echo "dracut cannot create an initrd." >&2
            exit 1
        } 
-       [[ $line =~ '([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)' ]] || continue
+       [[ $line =~ ([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*) ]] || continue
        FILE=${BASH_REMATCH[1]}
        [[ -f ${initdir}$FILE ]] && continue
        # see if we are loading an optimized version of a shared lib.
-       [[ $FILE =~ '^(/lib[^/]*).*' ]] && {
+       [[ $FILE =~ ^(/lib[^/]*).* ]] && {
             TLIBDIR=${BASH_REMATCH[1]}
             BASE="${FILE##*/}"
            # prefer nosegneg libs, then unoptimized ones.
@@ -116,7 +116,7 @@ inst_binary() {
 inst_script() {
     local src=$1 target=${2:-$1} line
     read -r -n 80 line <"$src"
-    [[ $line =~ '(#! *)(/[^ ]+).*' ]] || return 1
+    [[ $line =~ (#! *)(/[^ ]+).* ]] || return 1
     inst "${BASH_REMATCH[2]}" && inst_simple "$src" "$target"
 }