[arch-projects] [RFC] Remove sed from lvm2 initcpio hook
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
On 11/16/2011 10:54 AM, Gerardo Exequiel Pozzi wrote:
+ for pvdev in ${lvmwait/,/ }; do
whoops, must be //,/ fixed at https://gist.github.com/1370099/ and remove uneeded [ -n ... ] --- /lib/initcpio/hooks/lvm2 2011-08-19 21:38:09.000000000 -0300 +++ hooks/lvm2 2011-11-16 11:07:36.835256727 -0300 @@ -4,17 +4,17 @@ /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 - poll_device ${pvdev} ${rootdelay} - done - fi + for pvdev in ${lvmwait//,/ }; do + poll_device ${pvdev} ${rootdelay} + done [ "${quiet}" = "y" ] && LVMQUIET=">/dev/null" -- Gerardo Exequiel Pozzi \cos^2\alpha + \sin^2\alpha = 1
participants (1)
-
Gerardo Exequiel Pozzi