mkinitrd-6.0.93-remove-bash4ism.patch 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. diff -up mkinitrd-6.0.93/mkinitrd.remove-bash4ism mkinitrd-6.0.93/mkinitrd
  2. --- mkinitrd-6.0.93/mkinitrd.remove-bash4ism 2010-04-11 23:09:41.000000000 +0900
  3. +++ mkinitrd-6.0.93/mkinitrd 2010-04-12 01:07:01.000000000 +0900
  4. @@ -345,7 +345,7 @@ findstoragedriverinsys () {
  5. sysfs=$(readlink ${sysfs%/*})
  6. fi
  7. - if [[ ! "$sysfs" =~ '^/sys/.*block/.*$' ]]; then
  8. + if ! (echo "$sysfs" | egrep -q '^/sys/.*block/.*$' ); then
  9. error "WARNING: $sysfs is a not a block sysfs path, skipping"
  10. return
  11. fi
  12. @@ -356,12 +356,12 @@ findstoragedriverinsys () {
  13. *) handleddevices="$handleddevices $sysfs" ;;
  14. esac
  15. - if [[ "$sysfs" =~ '^/sys/.*block/md[0-9]+$' ]]; then
  16. + if ( echo "$sysfs" | egrep -q '^/sys/.*block/md[0-9]+$' ); then
  17. local raid=${sysfs##*/}
  18. vecho "Found MDRAID component $raid"
  19. handleraid $raid
  20. fi
  21. - if [[ "$sysfs" =~ '^/sys/.*block/dm-[0-9]+$' ]]; then
  22. + if ( echo "$sysfs" | egrep -q '^/sys/.*block/dm-[0-9]+$' ); then
  23. vecho "Found DeviceMapper component ${sysfs##*/}"
  24. handledm $(cat $sysfs/dev |cut -d : -f 1) $(cat $sysfs/dev |cut -d : -f 2)
  25. fi
  26. @@ -541,7 +541,7 @@ handledm() {
  27. dmname=$(dmsetup info -j $major -m $minor -c --noheadings -o name)
  28. # do the device resolution dance to get /dev/mapper/foo
  29. # since 'lvm lvs' doesn't like dm-X device nodes
  30. - if [[ "$slavedev" =~ ^dm- ]]; then
  31. + if (echo "$slavedev" | egrep -q '^dm-' ); then
  32. majmin=$(get_numeric_dev dec "/dev/$slavedev")
  33. for dmdev in /dev/mapper/* ; do
  34. dmnum=$(get_numeric_dev dev $dmdev)
  35. @@ -1266,7 +1266,7 @@ if [ "x$PROBE" == "xyes" ]; then
  36. else
  37. # check if it's root by label
  38. rdev=$rootdev
  39. - if [[ "$rdev" =~ ^(UUID=|LABEL=) ]]; then
  40. + if ( echo "$rdev" | egrep -q '^(UUID=|LABEL=)' ); then
  41. rdev=$(resolve_device_name "$rdev")
  42. fi
  43. rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
  44. @@ -1277,7 +1277,7 @@ if [ "x$PROBE" == "xyes" ]; then
  45. [ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
  46. swsuspdev="$thawdev"
  47. if [ -n "$swsuspdev" ]; then
  48. - if [[ "$swsuspdev" =~ ^(UUID=|LABEL=) ]]; then
  49. + if ( echo "$swsuspdev" | egrep -q '^(UUID=|LABEL=)' ); then
  50. swsuspdev=$(resolve_device_name "$swsuspdev")
  51. fi
  52. findstoragedriver "$swsuspdev"
  53. @@ -1315,7 +1315,7 @@ fi
  54. # loopfs : filesystem of loopdev
  55. # loopots : options to mount loopfs
  56. -if [ -n "${loopfs}" ] || [[ "$rootopts" =~ "loop" ]]; then
  57. +if [ -n "${loopfs}" ] || (echo "$rootopts" | grep "loop" ); then
  58. # FIXME: probe this somehow?
  59. rootdev=/dev/loop0
  60. @@ -1546,12 +1546,12 @@ emitmodules() {
  61. # we mount usbfs before the first module *after* the HCDs
  62. if [ "$usb_mounted" == "prep" ]; then
  63. - if [[ "$module" =~ ".hci[_-]hcd" ]]; then
  64. + if (echo "$module" | egrep -q ".hci[_-]hcd" ); then
  65. usb_mounted="no"
  66. found_hcd_module="yes"
  67. fi
  68. elif [ "$usb_mounted" == "no" ]; then
  69. - if [[ ! "$module" =~ ".hci[_-]hcd" ]]; then
  70. + if ! (echo "$module" | egrep -q ".hci[_-]hcd" ); then
  71. usb_mounted=yes
  72. emit "mount -t usbfs /proc/bus/usb /proc/bus/usb"
  73. fi
  74. @@ -1566,7 +1566,7 @@ emitmodules() {
  75. # Hack - we need a delay after loading usb-storage to give things
  76. # time to settle down before we start looking a block devices
  77. - if [[ "$module" =~ usb[_-]storage ]] || [ "$module" = "ub" ]; then
  78. + if (echo "$module" | egrep -q 'usb[_-]storage' ) || [ "$module" = "ub" ]; then
  79. if [ "$found_hcd_module" == "no" -a "$usb_mounted" == "prep" ]; then
  80. usb_mounted=yes
  81. emit "mount -t usbfs /proc/bus/usb /proc/bus/usb"
  82. @@ -1843,7 +1843,7 @@ if [ -z "$noresume" ]; then
  83. if [ -n "$tuxonicefwtarget" ]; then
  84. inst_tuxonice $SWSUSPPROC $MNTIMAGE $tuxonicefwtarget $USERUIPROC
  85. elif [ -n "$swsuspdev" ]; then
  86. - if [[ "$swsuspdev" =~ ^(UUID=|LABEL=) ]]; then
  87. + if (echo "$swsuspdev" | egrep -q '^(UUID=|LABEL=)' ); then
  88. swsuspdev=$(resolve_device_name "$swsuspdev")
  89. fi