Ignore:
Timestamp:
Jan 3, 2006, 4:09:12 PM (15 years ago)
Author:
bcornec
Message:

Patches from Sébastien Aperghis-Tramoni <maddingue@…>

replace several occurences of "cat .. | grep .."
or with similar commands that accept filenames as arguments.
+ some sort | uniq replaced by sort -u

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.06/mindi/mindi

    r258 r273  
    244244        included_list=`gzip -dc $mappath | fgrep -i include | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
    245245    else
    246         included_list=`cat $mappath | fgrep -i include | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
     246        included_list=`fgrep -i include $mappath | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
    247247    fi
    248248    for included_item in $included_list ; do
     
    313313    if [ ! -f "$copy_from" ] ; then
    314314        LogIt "OK, you don't have a /boot/boot.b file, which is odd because\n most _good_ Linux distributions come with one, even if it's only a softlink"
    315         copy_from=`cat /etc/lilo.conf | grep install= | grep "\.b" | cut -d'=' -f2`
     315        copy_from=`grep install= /etc/lilo.conf | grep "\.b" | cut -d'=' -f2`
    316316        if [ ! -f "$copy_from" ] ; then
    317317            LogIt "Nor can I find it from your /etc/lilo.conf file. This is very odd.\n"
     
    505505    outdir=$2
    506506
    507     list_of_optimized_libraries=`cat $filelist | grep "lib/i[5-7]86/"`
     507    list_of_optimized_libraries=`grep "lib/i[5-7]86/" $filelist`
    508508    if [ "$list_of_optimized_libraries" = "" ] ; then
    509509    return 0
     
    526526    ln -sf $vanilla_lib_name $outdir$optimized_lib_name
    527527    echo "Excluding $optimized_lib_name" >> $LOGFILE
    528     cat $filelist | fgrep -vx "$optimized_lib_name" > $filelist.tmp
     528    fgrep -vx "$optimized_lib_name $filelist" > $filelist.tmp
    529529    echo "Replacing it with $vanilla_lib_name" >> $LOGFILE
    530530    echo "$vanilla_lib_name" >> $filelist.tmp
    531531    mv -f $filelist.tmp $filelist
    532532    done
    533     cat $filelist | sort | $AWK '{ print $1; }' | uniq > $filelist.tmp
     533    sort $filelist | $AWK '{ print $1; }' | uniq > $filelist.tmp
    534534    mv -f $filelist.tmp $filelist
    535535    echo -e "$DONE"
     
    584584    fi
    585585    echo "keyfile=$keyfile" >> $LOGFILE
    586     locale=`cat "$keyfile" |fgrep KEYTABLE | tr -d '"' |cut -d'=' -f2`
    587     [ ! "$locale" ] && locale=`cat "$keyfile" | grep '.map$' | sed 's/^.* //'`      # Slackware
     586    locale=`fgrep KEYTABLE "$keyfile" | tr -d '"' |cut -d'=' -f2`
     587    [ ! "$locale" ] && locale=`grep '.map$' "$keyfile" | sed 's/^.* //'`        # Slackware
    588588    echo "locale=$locale" >> $LOGFILE
    589589    mp=`find $KEYDIR/keymaps | grep "i[3-8]86" | fgrep "${locale}." | grep -vx " *#.*"`
     
    998998    local res currline partition all_partitions ap_orig remaining i j
    999999
    1000     cat $MY_FSTAB | grep -vx " *#.*" | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}'
     1000    grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}'
    10011001#    for partition in `$FDISK -l | tr -s ' ' '\n' | grep /dev` ; do
    10021002#        [ -e "$i" ] && all_partitions=echo "$i"
     
    14251425        echo "Unknown partition (outstring = $unofficial_outstring)" >> $LOGFILE
    14261426    elif [ "$partition_mountpt" = "" ] && [ -f "/etc/raidtab" ] ; then
    1427         if [ "`cat /etc/raidtab 2> /dev/null | fgrep device | fgrep $current_partition`" ] ; then
     1427        if [ "`fgrep device /etc/raidtab 2>/dev/null | fgrep $current_partition`" ] ; then
    14281428        partition_mountpt=raid
    14291429        partition_format=raid
     
    14711471    rmdir $1
    14721472    echo -en "  " > $1
    1473     if [ "`cat /etc/issue.net 2> /dev/null | fgrep -i "debian"`" ] ; then
    1474         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ >> $1.tmp
    1475     else
    1476         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' '\\r' 'on' 'an' '\/' '`uname -r`' 'on' 'an' '`uname -m`/ >> $1.tmp
     1473    if [ "`fgrep -i "debian" /etc/issue.net 2> /dev/null`" ] ; then
     1474        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cut -d ' ' -f 3 /etc/issue.net` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ >> $1.tmp
     1475    else
     1476        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`grep -i "linux" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`grep -i "kernel" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' '\\r' 'on' 'an' '\/' '`uname -r`' 'on' 'an' '`uname -m`/ >> $1.tmp
    14771477    fi
    14781478    cat $1.tmp | sed s/%r/"`uname -r`"/ | sed s/%t/"`hostname`"/ > $1
     
    16401640    local disksize
    16411641    disksize=$1
    1642     if [ "`cat /etc/issue.net 2> /dev/null | fgrep -i "debian"`" ] ; then
    1643         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/
    1644     else
    1645         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' 'r' 'on' 'an' 'm/' '`uname -r`' 'on' 'an' '`uname -m`/
     1642    if [ "`fgrep -i "debian" /etc/issue.net 2> /dev/null`" ] ; then
     1643        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cut -d ' ' -f 3 /etc/issue.net` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/
     1644    else
     1645        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`grep -i "linux" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`grep -i "kernel" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' 'r' 'on' 'an' 'm/' '`uname -r`' 'on' 'an' '`uname -m`/
    16461646    fi
    16471647    if [ "$disksize" -gt "2880" ] ; then
     
    19441944    fi
    19451945    if [ $? -ne "0" ] ; then
    1946     if [ "`cat $LOGFILE | fgrep "/tmp/dev.0"`" ] ; then
     1946    if [ "`fgrep "/tmp/dev.0" $LOGFILE`" ] ; then
    19471947        LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n"
    19481948        LogIt "Please reboot your PC as a workaround.\n"
     
    21032103    tardir=$TMP_ROOT/tardir
    21042104
    2105     lines=`cat $MINDI_CONF/deplist.txt | grep -vx " *#.*" | grep -vx "" |wc -l`
     2105    lines=`grep -vx " *#.*" $MINDI_CONF/deplist.txt | grep -vx "" | wc -l`
    21062106    cat $MINDI_CONF/deplist.txt | GenerateGiantDependencyList $needlist $lines
    21072107    res=$?
     
    28762876    lsmod | cut -d' ' -f1 >> $fname
    28772877    lsmod | cut -d' ' -f1 >> $fname
    2878     modules=`cat $fname | sort | uniq -d2 | tr '\n' ' '`
     2878    modules=`sort $fname | uniq -d2 | tr '\n' ' '`
    28792879    rm -f $fname
    28802880    [ "$modules" ] && echo "Unsaved kernel modules: $modules" >> $LOGFILE
     
    29502950    FindLiloBinary
    29512951fi
    2952 cat /proc/mounts | fgrep " $TMP_ROOT " | fgrep tmpfs > /dev/null 2> /dev/null && TMP_ROOT=/home && LogIt "Changing TMP_ROOT to $TMP_ROOT because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason
     2952fgrep " $TMP_ROOT " /proc/mounts | fgrep tmpfs > /dev/null 2> /dev/null && TMP_ROOT=/home && LogIt "Changing TMP_ROOT to $TMP_ROOT because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason
    29532953rm -f /tmp/mindi_lo
    29542954trap "Aborted" SIGTERM
Note: See TracChangeset for help on using the changeset viewer.