Changeset 739 in MondoRescue


Ignore:
Timestamp:
Aug 4, 2006, 11:54:47 AM (18 years ago)
Author:
Bruno Cornec
Message:

Fix bug in start-nfs: $ needs to be escaped in that env.

Location:
branches/stable/mindi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/mindi

    r735 r739  
    14451445            items=0
    14461446            for i in `tr -s ' ' '\t' < /proc/swaps | grep -Fv "Filename" | cut -f3` ; do
    1447             totalsize=$(($totalsize+$i))
    1448             items=$(($items+1))
     1447                totalsize=$(($totalsize+$i))
     1448                items=$(($items+1))
    14491449            done
    1450                     [ "$items" -gt "0" ] && partition_size=$(($totalsize/$items)) || partition_size=0
     1450            [ "$items" -gt "0" ] && partition_size=$(($totalsize/$items)) || partition_size=0
    14511451            [ "$partition_size" -lt "125000" ] && partition_size=125000
    14521452            echo "I'm guessing $c_p is $(($partition_size/1024))MB" >> $LOGFILE
     
    14581458    if [ "$partition_mountpt" = "" ] ; then
    14591459        if [ "`pvdisplay $current_lvolume 2> /dev/null`" != "" ] || [ "`lvm pvdisplay $current_lvolume 2> /dev/null`" != "" ] ; then
    1460         if  [ "`grep -F device /etc/raidtab 2> /dev/null | grep -w $current_partition`" ] ; then
    1461             partition_mountpt="raid"
    1462             partition_format="raid"
    1463         else
    1464 #           lvm_dev="`pvdisplay $current_lvolume | grep -i "VG N" | head -n1 | tr -s ' ' ' ' | cut -d' ' -f3`"
    1465             partition_mountpt="lvm"
    1466             partition_format="lvm"
    1467         fi
     1460            if  [ "`grep -F device /etc/raidtab 2> /dev/null | grep -w $current_partition`" ] ; then
     1461                partition_mountpt="raid"
     1462                partition_format="raid"
     1463            else
     1464#               lvm_dev="`pvdisplay $current_lvolume | grep -i "VG N" | head -n1 | tr -s ' ' ' ' | cut -d' ' -f3`"
     1465                partition_mountpt="lvm"
     1466                partition_format="lvm"
     1467            fi
    14681468        fi
    14691469    fi
     
    14731473    if [ "`echo " $IMAGE_DEVS " | grep -F " $current_partition "`" != "" ] ; then
    14741474        partition_mountpt="image"
    1475             old_partition_fmt=$partition_format
     1475        old_partition_fmt=$partition_format
    14761476#       partition_format="`$FDISK -l 2>> $LOGFILE | tr -s '\t' ' ' | grep -w "$absolute_partition" | $AWK 'x=$(NF-1}'`"
    14771477        partition_format="`$FDISK -l 2>> $LOGFILE | tr '*' ' ' | tr '+' ' ' | tr -s ' ' '\t' | grep -w "$absolute_partition" | cut -f5`"
    1478             echo "------- $FDISK -l log ------------" >> $LOGFILE
    1479             cat $FDISKLOG >> $LOGFILE
    1480             echo "------- $FDISK log end ------------" >> $LOGFILE
     1478        echo "------- $FDISK -l log ------------" >> $LOGFILE
     1479        cat $FDISKLOG >> $LOGFILE
     1480        echo "------- $FDISK log end ------------" >> $LOGFILE
    14811481        partition_size=$(($partition_size+1)); # just in case
    1482             if [ "$partition_format" = "Linux" ] ; then
    1483                 echo "Are you imaging a mounted swap partition? Silly..." >> $LOGFILE
    1484                 echo "Reverting format from $old_partition_fmt to $partition_format" >> $LOGFILE
    1485                 partition_format=$old_partition_fmt
    1486             fi
    1487     fi
    1488         if [ "$EXCLUDE_DEVS" ] && [ "`echo " $EXCLUDE_DEVS " | grep -F " $current_partition "`" ] || [ "`echo " $EXCLUDE_DEVS " | grep " $current_partition "`" ] ; then
    1489             echo "Excluding $current_partition from mountlist" >> $LOGFILE
    1490             continue
    1491         fi
    1492         if [ ! "$partition_mountpt" ] ; then
     1482        if [ "$partition_format" = "Linux" ] ; then
     1483            echo "Are you imaging a mounted swap partition? Silly..." >> $LOGFILE
     1484            echo "Reverting format from $old_partition_fmt to $partition_format" >> $LOGFILE
     1485            partition_format=$old_partition_fmt
     1486        fi
     1487    fi
     1488    if [ "$EXCLUDE_DEVS" ] && [ "`echo " $EXCLUDE_DEVS " | grep -F " $current_partition "`" ] || [ "`echo " $EXCLUDE_DEVS " | grep " $current_partition "`" ] ; then
     1489        echo "Excluding $current_partition from mountlist" >> $LOGFILE
     1490        continue
     1491    fi
     1492    if [ ! "$partition_mountpt" ] ; then
    14931493        for qq in "" `find /dev/ida/c*d* ! -name '*p*'` ; do
    1494         partition_format=`$FDISK -l $qq 2>> $LOGFILE | grep -w "$c_p" | sed 's/12/|/' | tr -s '\t' ' ' | cut -d'|' -f2 | cut -d' ' -f2-9`
    1495                 echo "------- $FDISK -l $qq log ------------" >> $LOGFILE
    1496                 cat $FDISKLOG >> $LOGFILE
    1497                 echo "------- $FDISK log end ------------" >> $LOGFILE
    1498         [ "$partition_format" ] && break
     1494            partition_format=`$FDISK -l $qq 2>> $LOGFILE | grep -w "$c_p" | sed 's/12/|/' | tr -s '\t' ' ' | cut -d'|' -f2 | cut -d' ' -f2-9`
     1495            echo "------- $FDISK -l $qq log ------------" >> $LOGFILE
     1496            cat $FDISKLOG >> $LOGFILE
     1497            echo "------- $FDISK log end ------------" >> $LOGFILE
     1498            [ "$partition_format" ] && break
    14991499        done
    15001500        if [ "$partition_format" = "Compaq diagnostics" ] ; then
    1501         partition_format="compaq"
     1501            partition_format="compaq"
    15021502        elif [ ! "`grep -F device /etc/raidtab 2> /dev/null | grep -w $current_partition`" ] ; then
    1503         LogIt "Unable to find mountpoint of $current_partition - ignoring\n"
    1504         continue
     1503            LogIt "Unable to find mountpoint of $current_partition - ignoring\n"
     1504            continue
    15051505        fi
    15061506    fi
     
    15191519            echo "Unknown mountpoint (outstring = $unofficial_outstring)" >> $LOGFILE
    15201520        fi
    1521         elif [ "$partition_format" = "" ] ; then
     1521    elif [ "$partition_format" = "" ] ; then
    15221522        echo "Unknown format (outstring = $unofficial_outstring)" >> $LOGFILE
    15231523    elif [ "$partition_size" = "" ] ; then
     
    15261526        continue
    15271527    else
    1528             if [ "$partition_format" = "dos" ] || [ "$partition_format" = "msdos" ] ; then
    1529                 echo "Stupid bastard..." >> $LOGFILE
    1530                 partition_format="vfat"
    1531             fi
     1528        if [ "$partition_format" = "dos" ] || [ "$partition_format" = "msdos" ] ; then
     1529            echo "Stupid bastard..." >> $LOGFILE
     1530            partition_format="vfat"
     1531        fi
    15321532        printf "\t%-15s %-15s %-15s %7s %-15s\n" $current_partition $partition_mountpt $partition_format $psz "$redhat_label"
    15331533        printf "%s %s %s %s %s\n" $current_partition $partition_mountpt $partition_format $partition_size "$redhat_label" >> $mountlist
  • branches/stable/mindi/rootfs/sbin/init

    r737 r739  
    287287    if [ -e "/tmp/i-want-my-lvm" ] ; then
    288288        LogIt "Scanning LVM's..." 1
    289     if which lvm ; then
    290         MyInsmod dm-mod
    291         MyInsmod dm_mod
    292         lvm vgscan --mknodes
    293     else
    294         vgscan
    295     fi
     289        if which lvm ; then
     290            MyInsmod dm-mod
     291            MyInsmod dm_mod
     292            lvm vgscan --mknodes
     293        else
     294            vgscan
     295        fi
    296296        grep -E "^#.*vgchange" /tmp/i-want-my-lvm | sed "s/^#[ ]*//" > /tmp/start-lvm
    297297        chmod +x /tmp/start-lvm
     
    484484nfsmount=`grep nfs-server-mount /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    485485imgname=`grep iso-prefix /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    486 if [ "$imgname" = "" ]; then
     486if [ "\$imgname" = "" ]; then
    487487    imgname="mondorescue"
    488488fi
    489489dirimg=`grep nfs-server-path /tmp/mondo-restore.cfg | cut -d' ' -f2-`
    490 if [ "$dirimg" = "" ]; then
     490if [ "\$dirimg" = "" ]; then
    491491    dirimg="/"
    492492fi
     
    494494# info from cmdline are predominent
    495495for i in `cat /proc/cmdline` ; do
    496     echo $i | grep -qi ping= && ipcount=`echo $i | cut -d= -f2`
    497     echo $i | grep -qi ipconf= && ipconf=`echo $i | cut -d= -f2`
    498     echo $i | grep -qi nfsmount= && nfsmount=`echo $i | cut -d= -f2`
    499     echo $i | grep -qi prefix= && imgname=`echo $i | cut -d= -f2`
     496    echo \$i | grep -qi ping= && ipcount=`echo \$i | cut -d= -f2`
     497    echo \$i | grep -qi ipconf= && ipconf=`echo \$i | cut -d= -f2`
     498    echo \$i | grep -qi nfsmount= && nfsmount=`echo \$i | cut -d= -f2`
     499    echo \$i | grep -qi prefix= && imgname=`echo \$i | cut -d= -f2`
    500500done
    501501
    502 if [ $ipdev = "" ] && [ $ipconf = "" ]; then
     502if [ \$ipdev = "" ] && [ \$ipconf = "" ]; then
    503503    # No network configuration neither stored during archive
    504504    # nor on cmdline so no network wanted => exiting
     
    511511ifconfig lo 127.0.0.1
    512512
    513 echo "$ipconf" | grep -q "dhcp"
    514 if [ $? -eq 0 ]; then
    515     ipdev=`echo $ipconf | cut -d: -f1`
    516     echo "Making DHCP request on $ipdev"
    517     udhcpc -i $ipdev
     513echo "\$ipconf" | grep -q "dhcp"
     514if [ \$? -eq 0 ]; then
     515    ipdev=`echo \$ipconf | cut -d: -f1`
     516    echo "Making DHCP request on \$ipdev"
     517    udhcpc -i \$ipdev
    518518else
    519     if [ "$ipconf" != "" ]; then
    520         ipdev=`echo $ipconf | cut -d: -f1`
    521         ipaddress=`echo $ipconf | cut -d: -f2`
    522         ipnetmask=`echo $ipconf | cut -d: -f3`
    523         ipbroadcast=`echo $ipconf | cut -d: -f4`
    524         ipgateway=`echo $ipconf | cut -d: -f5`
     519    if [ "\$ipconf" != "" ]; then
     520        ipdev=`echo \$ipconf | cut -d: -f1`
     521        ipaddress=`echo \$ipconf | cut -d: -f2`
     522        ipnetmask=`echo \$ipconf | cut -d: -f3`
     523        ipbroadcast=`echo \$ipconf | cut -d: -f4`
     524        ipgateway=`echo \$ipconf | cut -d: -f5`
    525525    fi
    526     echo "Configuring $ipdev statically ($ipaddress/$ipnetmask)"
    527     ifconfig $ipdev $ipaddress netmask $ipnetmask broadcast $ipbroadcast
    528     route add default gw $ipgateway
     526    echo "Configuring \$ipdev statically (\$ipaddress/\$ipnetmask)"
     527    ifconfig \$ipdev \$ipaddress netmask \$ipnetmask broadcast \$ipbroadcast
     528    route add default gw \$ipgateway
    529529fi
    530530
    531531# ping server helps waking interface up
    532532LogIt "Pinging NFS server..."
    533 nfs_server_ipaddr=`echo $nfsmount | cut -d: -f1`
    534 ping -c $ipcount $nfs_server_ipaddr
     533nfs_server_ipaddr=`echo \$nfsmount | cut -d: -f1`
     534ping -c \$ipcount \$nfs_server_ipaddr
    535535
    536536# Finally mounts the NFS share
    537 LogIt "Mounting NFS share ($nfsmount) on /tmp/isodir..."
    538 mount -t nfs -o nolock $nfsmount /tmp/isodir
    539 
    540 LogIt "Mounting NFS image $imgname-1.iso in $dirimg on /mnt/cdrom in loopback"
    541 losetup /dev/loop7 /tmp/isodir/$dirimg/$imgname-1.iso
     537LogIt "Mounting NFS share (\$nfsmount) on /tmp/isodir..."
     538mount -t nfs -o nolock \$nfsmount /tmp/isodir
     539
     540LogIt "Mounting NFS image \$imgname-1.iso in \$dirimg on /mnt/cdrom in loopback"
     541losetup /dev/loop7 /tmp/isodir/\$dirimg/\$imgname-1.iso
    542542mount -o ro -t iso9660 /dev/loop7 /mnt/cdrom
    543543EOF
  • branches/stable/mindi/rootfs/sbin/post-init

    r273 r739  
    7272else
    7373    if [ "$iso$nuke$compare$interactive" != "" ] ; then
    74     LogIt "FYI, this CD was made by Mindi, not Mondo." 1
    75     exit 0
    76 
     74        LogIt "FYI, this CD was made by Mindi, not Mondo." 1
     75        exit 0
    7776    else
    78     LogIt "Mindi-Linux has finished booting."
     77        LogIt "Mindi-Linux has finished booting."
    7978    fi
    8079fi
Note: See TracChangeset for help on using the changeset viewer.