source: projects/specs/trunk/m/mkinitrd/mkinitrd-6.0.93-remove-bash4ism.patch @ 806

Revision 806, 4.4 KB checked in by daisuke, 14 years ago (diff)

mkinitrd: remove bash4ism (patch21), add vine patches to repo

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