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

  • mkinitrd-6.0.93/mkinitrd

    diff -up mkinitrd-6.0.93/mkinitrd.remove-bash4ism mkinitrd-6.0.93/mkinitrd
    old new findstoragedriverinsys () { 
    345345        sysfs=$(readlink ${sysfs%/*}) 
    346346    fi 
    347347 
    348     if [[ ! "$sysfs" =~ '^/sys/.*block/.*$' ]]; then 
     348    if ! (echo "$sysfs" | egrep -q '^/sys/.*block/.*$' ); then 
    349349        error "WARNING: $sysfs is a not a block sysfs path, skipping" 
    350350        return 
    351351    fi 
    findstoragedriverinsys () { 
    356356        *) handleddevices="$handleddevices $sysfs" ;; 
    357357    esac 
    358358 
    359     if [[ "$sysfs" =~ '^/sys/.*block/md[0-9]+$' ]]; then 
     359    if ( echo "$sysfs" | egrep -q '^/sys/.*block/md[0-9]+$' ); then 
    360360        local raid=${sysfs##*/} 
    361361        vecho "Found MDRAID component $raid" 
    362362        handleraid $raid 
    363363    fi 
    364     if [[ "$sysfs" =~ '^/sys/.*block/dm-[0-9]+$' ]]; then 
     364    if ( echo "$sysfs" | egrep -q '^/sys/.*block/dm-[0-9]+$' ); then 
    365365        vecho "Found DeviceMapper component ${sysfs##*/}" 
    366366        handledm $(cat $sysfs/dev |cut -d : -f 1) $(cat $sysfs/dev |cut -d : -f 2) 
    367367    fi 
    handledm() { 
    541541                dmname=$(dmsetup info -j $major -m $minor -c --noheadings -o name) 
    542542                # do the device resolution dance to get /dev/mapper/foo 
    543543                # since 'lvm lvs' doesn't like dm-X device nodes 
    544                 if [[ "$slavedev" =~ ^dm- ]]; then 
     544                if (echo "$slavedev" | egrep -q '^dm-' ); then 
    545545                    majmin=$(get_numeric_dev dec "/dev/$slavedev") 
    546546                    for dmdev in /dev/mapper/* ; do 
    547547                        dmnum=$(get_numeric_dev dev $dmdev) 
    if [ "x$PROBE" == "xyes" ]; then 
    12661266    else 
    12671267        # check if it's root by label 
    12681268        rdev=$rootdev 
    1269         if [[ "$rdev" =~ ^(UUID=|LABEL=) ]]; then 
     1269        if ( echo "$rdev" | egrep -q '^(UUID=|LABEL=)' ); then 
    12701270            rdev=$(resolve_device_name "$rdev") 
    12711271        fi 
    12721272        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/') 
    if [ "x$PROBE" == "xyes" ]; then 
    12771277    [ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab) 
    12781278    swsuspdev="$thawdev" 
    12791279    if [ -n "$swsuspdev" ]; then 
    1280         if [[ "$swsuspdev" =~ ^(UUID=|LABEL=) ]]; then 
     1280        if ( echo "$swsuspdev" | egrep -q '^(UUID=|LABEL=)' ); then 
    12811281            swsuspdev=$(resolve_device_name "$swsuspdev") 
    12821282        fi 
    12831283        findstoragedriver "$swsuspdev" 
    fi 
    13151315# loopfs : filesystem of loopdev 
    13161316# loopots : options to mount loopfs 
    13171317 
    1318 if [ -n "${loopfs}" ] || [[ "$rootopts" =~ "loop" ]]; then 
     1318if [ -n "${loopfs}" ] || (echo "$rootopts" | grep "loop" ); then 
    13191319        # FIXME: probe this somehow? 
    13201320         
    13211321        rootdev=/dev/loop0 
    emitmodules() { 
    15461546 
    15471547        # we mount usbfs before the first module *after* the HCDs 
    15481548        if [ "$usb_mounted" == "prep" ]; then 
    1549             if [[ "$module" =~ ".hci[_-]hcd" ]]; then 
     1549            if (echo "$module" | egrep -q ".hci[_-]hcd" ); then 
    15501550                usb_mounted="no" 
    15511551                found_hcd_module="yes" 
    15521552            fi 
    15531553        elif [ "$usb_mounted" == "no" ]; then 
    1554             if [[ ! "$module" =~ ".hci[_-]hcd" ]]; then 
     1554            if ! (echo "$module" | egrep -q ".hci[_-]hcd" ); then 
    15551555                usb_mounted=yes 
    15561556                emit "mount -t usbfs /proc/bus/usb /proc/bus/usb" 
    15571557            fi 
    emitmodules() { 
    15661566 
    15671567        # Hack - we need a delay after loading usb-storage to give things 
    15681568        #        time to settle down before we start looking a block devices 
    1569         if [[ "$module" =~ usb[_-]storage ]] || [ "$module" = "ub" ]; then  
     1569        if (echo "$module" | egrep -q 'usb[_-]storage' ) || [ "$module" = "ub" ]; then 
    15701570            if [ "$found_hcd_module" == "no" -a "$usb_mounted" == "prep" ]; then 
    15711571                usb_mounted=yes 
    15721572                emit "mount -t usbfs /proc/bus/usb /proc/bus/usb" 
    if [ -z "$noresume" ]; then 
    18431843    if [ -n "$tuxonicefwtarget" ]; then 
    18441844        inst_tuxonice $SWSUSPPROC $MNTIMAGE $tuxonicefwtarget $USERUIPROC 
    18451845    elif [ -n "$swsuspdev" ]; then 
    1846         if [[ "$swsuspdev" =~ ^(UUID=|LABEL=) ]]; then 
     1846        if (echo "$swsuspdev" | egrep -q '^(UUID=|LABEL=)' ); then 
    18471847            swsuspdev=$(resolve_device_name "$swsuspdev") 
    18481848        fi 
    18491849 
Note: See TracBrowser for help on using the repository browser.