Changeset 2965


Ignore:
Timestamp:
Mar 14, 2012, 2:42:33 AM (6 years ago)
Author:
bruno
Message:

r4564@localhost: bruno | 2012-03-13 00:55:09 +0100

  • Fix more #589 by removing fixed path for grep in mindi, and managing correctly paths for udev related binaries in mindi and rcS
Location:
branches/3.0/mindi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mindi/mindi

    r2964 r2965  
    10811081        uuid=""
    10821082        absolute_partition=`readlink -f $c_p`
    1083         partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
     1083        partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | grep -w "$current_partition" | grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
    10841084
    10851085        # Detects noauto partitions not mounted and exclude them
    1086         partition_option=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $4}' | head -n1`
     1086        partition_option=`tr -s '\t' ' ' < $MY_FSTAB | grep -w "$current_partition" | grep -vx " *#.*" | $AWK '{print $4}' | head -n1`
    10871087        if [ "`echo "$partition_option" | grep -i noauto`" != "" ] && [ "`mount | grep -w "$partition_mountpt"`" =  "" ] ; then
    10881088            continue
     
    10941094        # This part tries to retrieve the correct device from a LABEL line in /etc/fstab
    10951095        # current_partition contains only first column of /etc/fstab
    1096         if [ "`echo "$current_partition" | /bin/grep -i "LABEL="`" != "" ]; then
     1096        if [ "`echo "$current_partition" | grep -i "LABEL="`" != "" ]; then
    10971097            redhat_label=`echo "$current_partition" | cut -d'=' -f2`
    10981098            actual_dev=""
     
    11051105            # 2nd try : blkid, the good way for all LABEL except swap
    11061106            if [ "x$actual_dev" = "x" -a -x "/sbin/blkid" ]; then
    1107                 actual_dev=`/sbin/blkid | /bin/grep "$redhat_label" | grep LABEL= | cut -d':' -f1`
     1107                actual_dev=`/sbin/blkid | grep "$redhat_label" | grep LABEL= | cut -d':' -f1`
    11081108                # For LVM FS it will give a /dev/dm-# which should then be converted
    11091109                if [ $LVM = "v2" ] && [ "`echo $actual_dev | grep '/dev/dm'`" ]; then
     
    11241124            # For LVM gives a /dev/mapper entry
    11251125            if [ "x$actual_dev" = "x" ]; then
    1126                 actual_dev=`/bin/mount -l | /bin/grep "\[$redhat_label\]" | cut -d' ' -f1`
     1126                actual_dev=`/bin/mount -l | grep "\[$redhat_label\]" | cut -d' ' -f1`
    11271127            fi
    11281128   
     
    11301130            # SWAP only
    11311131            if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ]; then
    1132                 list_swaps=`cat /proc/swaps | /bin/grep "/dev/" | $AWK '{ print $1 }' `
     1132                list_swaps=`cat /proc/swaps | grep "/dev/" | $AWK '{ print $1 }' `
    11331133                for dev_swap in $list_swaps ; do
    1134                     dev_exists=`/sbin/vol_id $dev_swap | /bin/grep "$redhat_label"`
     1134                    dev_exists=`/sbin/vol_id $dev_swap | grep "$redhat_label"`
    11351135                    if [ "x$dev_exists" != "x" ]; then
    11361136                        actual_dev=$dev_swap
     
    11441144            # or could be a string that isn't a complete device name (eg. LABEL =SWAP-cciss/c0d0p)
    11451145            # SWAP only
    1146             if [ "x$actual_dev" = "x" -a  _"`echo $current_partition | /bin/grep -iE 'LABEL=SWAP|LABEL=SW-'`" != _"" ]; then
     1146            if [ "x$actual_dev" = "x" -a  _"`echo $current_partition | grep -iE 'LABEL=SWAP|LABEL=SW-'`" != _"" ]; then
    11471147                    skip=""
    11481148                    uname=$KERVERRUN
     
    11751175        # This part tries to retrieve the correct device from a UUID line in /etc/fstab
    11761176        # current_partition contains only first column of /etc/fstab
    1177         elif [ "`echo "$current_partition" | /bin/grep -i "UUID="`" != "" ]; then
     1177        elif [ "`echo "$current_partition" | grep -i "UUID="`" != "" ]; then
    11781178            uuid=`echo "$current_partition" | cut -d'=' -f2`
    11791179            actual_dev=""
     
    11861186            # 2nd try : blkid, the good way for all UUID except swap
    11871187            if [ "x$actual_dev" = "x" -a -x "/sbin/blkid" ]; then
    1188                 actual_dev=`/sbin/blkid | /bin/grep "$uuid" | grep UUID= | cut -d':' -f1`
     1188                actual_dev=`/sbin/blkid | grep "$uuid" | grep UUID= | cut -d':' -f1`
    11891189                # For LVM FS it will give a /dev/dm-# which should then be converted
    11901190                if [ $LVM = "v2" ] && [ "`echo $actual_dev | grep '/dev/dm'`" ]; then
     
    12041204            # 3th try, with vol_id
    12051205            if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ]; then
    1206                 list_dev=`mount | /bin/grep -E '^/' | $AWK '{ print $1 }' `
     1206                list_dev=`mount | grep -E '^/' | $AWK '{ print $1 }' `
    12071207                for dev in $list_dev ; do
    1208                     dev_exists=`/sbin/vol_id $dev | /bin/grep "$uuid"`
     1208                    dev_exists=`/sbin/vol_id $dev | grep "$uuid"`
    12091209                    if [ "x$dev_exists" != "x" ]; then
    12101210                        actual_dev=$dev
     
    12161216            # 4th try, with dumpuuid (VMWare only ?) for swap
    12171217            if [ "x$actual_dev" = "x" -a -x "/sbin/dumpuuid" ]; then
    1218                 list_dev=`cat /proc/swaps | /bin/grep -E '^/' | $AWK '{ print $1 }' `
     1218                list_dev=`cat /proc/swaps | grep -E '^/' | $AWK '{ print $1 }' `
    12191219                for dev in $list_dev ; do
    1220                     dev_exists=`/sbin/dumpuuid $dev | /bin/grep "$uuid"`
     1220                    dev_exists=`/sbin/dumpuuid $dev | grep "$uuid"`
    12211221                    if [ "x$dev_exists" != "x" ]; then
    12221222                        actual_dev=$dev
     
    12371237            if [ _"$partition_mountpt" = _"" ]; then
    12381238                # set default in case we dont't find it
    1239                 for tmpp in `tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -Ev "^#" | $AWK '{print $1}'`; do
     1239                for tmpp in `tr -s '\t' ' ' < $MY_FSTAB | grep -Ev "^#" | $AWK '{print $1}'`; do
    12401240                        if [ _"`readlink -f $tmpp`" = _"$current_partition" ]; then
    12411241                            str_to_find_fmt_with=$tmpp
    1242                             partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$tmpp" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
     1242                            partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | grep -w "$tmpp" | grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
    12431243                            break;
    12441244                        fi
     
    25442544            tar cf - -C / /lib/udev 2>> $MINDI_TMP/$$.log | tar xf -  || LogIt "ERROR: Problem in /lib/udev analysis" $MINDI_TMP/$$.log
    25452545        fi
    2546         if [ -x /sbin/udevd ]; then
     2546        if [ -x /sbin/udevd ] || [ -x /usr/bin/udevd ]; then
    25472547            lis2=`grep -Ev '^#' $DEPLIST_DIR/udev.conf`
    25482548            lis=""
     
    25722572            rm -f $MINDI_TMP/udev.lis
    25732573        else
    2574             LogAll "WARNING: udevd daemon not in standard place (/sbin)"
     2574            LogAll "WARNING: udevd daemon not in standard place (/sbin or /usr/bin)"
    25752575            LogAll "         mindi will use static devices which may cause problems"
    25762576            rm -f $mountpoint/tmp/USE-UDEV
  • branches/3.0/mindi/rootfs/etc/init.d/rcS

    r2964 r2965  
    322322    ps | grep -v grep |grep udevd 2> /dev/null 1> /dev/null
    323323    if [ $? -ne 0 ]; then
    324         /sbin/udevd --daemon &
     324        if [ -x /sbin/udevd ]; then
     325            /sbin/udevd --daemon &
     326        elif [ -x /usr/bin/udevd ]; then
     327            /usr/bin/udevd --daemon &
     328        fi
    325329        echo "Waiting for udev to start..."
    326330        sleep 5
     
    337341        /sbin/udevsettle --timeout=10
    338342        LogIt "Discovering with udevsettle"
    339     elif [ -x /sbin/udevadm ]; then
    340         UdevadmTrigger
    341         /sbin/udevadm settle --timeout=10
     343    elif [ -x /sbin/udevadm ] || [ -x /usr/bin/udevadm ]; then
     344        ua=`UdevadmTrigger`
     345        $ua settle --timeout=10
    342346        LogIt "Discovering with udevadm"
    343347    fi
     
    709713UdevadmTrigger() {
    710714
     715# This function should just echo the return value $ua
     716
    711717if [ -x /sbin/udevadm ]; then
    712     v=`/sbin/udevadm --version`
    713     echo "Triggering udev again..."
    714     if [ "$v" -ge "146" ]; then
    715         /sbin/udevadm trigger --type=failed
     718    ua="/sbin/udevadm"
     719elif [ -x /usr/bin/udevadm ]; then
     720    ua="/usr/bin/udevadm"
     721else
     722    LogIt "WARNING: Unable to find udevadm. Not triggering udev"
     723    ua="/bin/true"
     724fi
     725
     726v="`$ua --version`"
     727
     728if [ -x "$v" ]; then
     729    LogIt "Triggering udev again..."
     730    if [ "$v" -ge "146" -a "$v" -lt "174" ]; then
     731        $ua trigger --type=failed
     732    elif [ "$v" -lt "146" ]; then
     733        $ua trigger --retry-failed
    716734    else
    717         /sbin/udevadm trigger --retry-failed
    718     fi
    719 fi
     735        LogIt "... not needed"
     736    fi
     737fi
     738echo $ua
    720739}
    721740
     
    733752    # (useful for rules creating network ifcfg files)
    734753    if [ -e "/tmp/USE-UDEV" ] ; then
    735         UdevadmTrigger
     754        ua=`UdevadmTrigger`
    736755    fi
    737756}
     
    940959# Not sure it's still needed, but shouldn't hurt
    941960if [ -e "/tmp/USE-UDEV" ] ; then
    942     UdevadmTrigger
     961    ua=`UdevadmTrigger`
    943962fi
    944963if grep "backup-media-type" /tmp/mondo-restore.cfg > /dev/null 2> /dev/null ; then
Note: See TracChangeset for help on using the changeset viewer.