mkinitrd unification across distributions
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins-cCz0Lq7MMjm9FHfhHBbuYA@public.gmane.org>
To: initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] dracut-gencmdline: fix regex quoting in findstoragedriver()
Date: Thu, 29 Oct 2009 11:25:53 +0000	[thread overview]
Message-ID: <4AE97BC1.6010205@tuffmail.co.uk> (raw)

On my LVM system this changes the relevant output from "rd_NO_LVM" to
"rd_LVM_VG=alan-desktop.Linux"

Note that on my newer system, it now reaches moduledep() and complains.
I don't know enough awk to tell whose fault it is :). 

    awk: line 2: function gensub never defined
    awk: line 2: function gensub never defined
    rd_NO_MD rd_NO_LVM rd_NO_LUKS LANG=en_GB.UTF-8 root=/dev/sda2

Both my systems (old ubuntu and debian unstable) agree that bash
regexes should not be quoted:

    $ [[ 'a' =~ a ]] && echo match
    match
    $ [[ 'a' =~ ^a$ ]] && echo match
    match
    $ [[ 'a' =~ '^a$' ]] && echo match
    $

(and yes, it is safe against globbing)

    $ touch 9
    $ echo [0-9]
    9
    $ [[ 1 =~ [0-9] ]] && echo match
    match

diff --git a/dracut-gencmdline b/dracut-gencmdline
index 978f5a2..02509dd 100755
--- a/dracut-gencmdline
+++ b/dracut-gencmdline
@@ -212,7 +215,7 @@ findstoragedriverinsys () {
         sysfs=$(freadlink ${sysfs%/*})
     fi
 
-    if [[ ! "$sysfs" =~ '^/sys/.*block/.*$' ]]; then
+    if [[ ! "$sysfs" =~ ^/sys/.*block/.*$ ]]; then
         #error "WARNING: $sysfs is a not a block sysfs path, skipping"
         return
     fi
@@ -223,12 +226,12 @@ findstoragedriverinsys () {
         *) handleddevices="$handleddevices $sysfs" ;;
     esac
 
-    if [[ "$sysfs" =~ '^/sys/.*block/md[0-9]+$' ]]; then
+    if [[ "$sysfs" =~ ^/sys/.*block/md[0-9]+$ ]]; then
         local raid=${sysfs##*/}
         vecho "Found MDRAID component $raid"
         handleraid $raid
     fi
-    if [[ "$sysfs" =~ '^/sys/.*block/dm-[0-9]+$' ]]; then
+    if [[ "$sysfs" =~ ^/sys/.*block/dm-[0-9]+$ ]]; then
         vecho "Found DeviceMapper component ${sysfs##*/}"
         handledm $(cat $sysfs/dev |cut -d : -f 1) $(cat $sysfs/dev |cut -d : -f 2)
     fi


                 reply	other threads:[~2009-10-29 11:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AE97BC1.6010205@tuffmail.co.uk \
    --to=alan-jenkins-ccz0lq7mmjm9fhfhhbbuya@public.gmane.org \
    --cc=initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox