[arch-projects] [RFC] Remove sed from lvm2 initcpio hook

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Wed Nov 16 08:54:03 EST 2011


https://gist.github.com/1370099 (this patch)

--- /lib/initcpio/hooks/lvm2    2011-08-19 21:38:09.000000000 -0300
+++ hooks/lvm2    2011-11-16 10:35:34.474256727 -0300
@@ -4,14 +4,16 @@
      /sbin/modprobe -q dm-mod >/dev/null 2>&1
      if [ -e "/sys/class/misc/device-mapper" ]; then
          if [ ! -e "/dev/mapper/control" ]; then
+            local major minor
+            IFS=: read major minor < /sys/class/misc/device-mapper/dev
              mkdir /dev/mapper
-            mknod "/dev/mapper/control" c $(cat 
/sys/class/misc/device-mapper/dev | sed 's|:| |')
+            mknod /dev/mapper/control c ${major} ${minor}
          fi

          # If the lvmwait= parameter has been specified on the command line
          # wait for the device(s) before trying to activate the volume 
group(s)
          if [ -n "${lvmwait}" ]; then
-            for pvdev in $(echo ${lvmwait} | sed 's|,| |g'); do
+            for pvdev in ${lvmwait/,/ }; do
                  poll_device ${pvdev} ${rootdelay}
              done
          fi

-- 
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1



More information about the arch-projects mailing list