Changeset 305


Ignore:
Timestamp:
Jan 12, 2006, 5:37:42 PM (13 years ago)
Author:
bcornec
Message:

use df -P everywhere to avoid split lines on df output and some bugs

Location:
branches/2.06
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/2.06/mindi/aux-tools/sbin/format-and-kludge-vfat

    r273 r305  
    107107[ ! -e "/mnt/tmpK" ] && mkdir /mnt/tmpK
    108108mount $device -t vfat /mnt/tmpK || Die "Can't mount device $device"
    109 size=`df -m /mnt/tmpK | tr -s ' ' ' ' | cut -d' ' -f2 | tail -n 1`
     109size=`df -m -P /mnt/tmpK | tr -s ' ' ' ' | cut -d' ' -f2 | tail -n 1`
    110110umount /mnt/tmpK || Die "Can't unmount /mnt/tmpK"
    111111
  • branches/2.06/mindi/mindi

    r303 r305  
    19011901    rm -Rf $mountpoint/lost+found
    19021902    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
    1903     free_space=`df -k $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     1903    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
    19041904    cp -f $kernelpath $mountpoint/vmlinuz > /dev/null 2> /dev/null
    19051905    if [ "$?" -ne "0" ] || [ "$FORCE_DUAL_FLOPPIES" = "yes" ] ; then
     
    19241924    return $res
    19251925    fi
    1926     free_space=`df -k $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     1926    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
    19271927    max_kernel_size=$(($free_space+`du -sk $kernelpath | cut -f1`))
    19281928    echo "Free space left on floppy = $free_space KB" >> $LOGFILE
     
    20382038    rm -Rf $mountpoint/lost+found
    20392039    dd if=/dev/zero of=$mountpoint/zero bs=1k count=16 &> /dev/null
    2040     free_space=`df -k $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     2040    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
    20412041    cp -f $kernelpath $mountpoint/vmlinuz &> /dev/null
    20422042    if [ "$?" -ne "0" ] || [ "$FORCE_DUAL_FLOPPIES" = "yes" ] ; then
     
    20612061        return $res
    20622062    fi
    2063     free_space=`df -k $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
     2063    free_space=`df -k -P $mountpoint | tail -n1 | tr -s ' ' '\t' | cut -f4`
    20642064    max_kernel_size=$(($free_space+`du -sk $kernelpath | cut -f1`))
    20652065    echo "Free space left on floppy = $free_space KB" >> $LOGFILE
     
    24102410    echo "------- $FDISK log end ------------" >> $LOGFILE
    24112411# end patch
    2412     [ "$res" = "" ] && res=`df -k -x supermount | tr -s '\t' ' ' | fgrep "$device " | cut -d' ' -f2`
     2412    [ "$res" = "" ] && res=`df -k -P -x supermount | tr -s '\t' ' ' | fgrep "$device " | cut -d' ' -f2`
    24132413    [ "$res" = "" ] && res="-1"
    24142414    echo $res
  • branches/2.06/mindi/rootfs/sbin/init

    r287 r305  
    342342
    343343HowMuchFreeSpaceOnRamdisk() {
    344    df -m | grep /dev/ram | head -n1 | tr -s '\t' ' ' | cut -d' ' -f4
     344   df -m -P | grep /dev/ram | head -n1 | tr -s '\t' ' ' | cut -d' ' -f4
    345345}
    346346
  • branches/2.06/mondo/ChangeLog

    r296 r305  
    1414- Replaced partimagehack with ntfsclone from ntfsprogs package.
    1515  (Andree Leidenfrost)
     16- use df -P everywhere (Bruno Cornec)
    1617
    1718v2.06 (2005-12-23)
  • branches/2.06/mondo/mondo/common/libmondo-archive.c

    r296 r305  
    545545    if (g_tmpfs_mountpt[0] != '\0') {
    546546        i = atoi(call_program_and_get_last_line_of_output
    547                  ("df -m | grep dev/shm | grep -v none | tr -s ' ' '\t' | cut -f4"));
     547                 ("df -m -P | grep dev/shm | grep -v none | tr -s ' ' '\t' | cut -f4"));
    548548        if (i > 0) {
    549549            if (free_ramdisk_space > i) {
  • branches/2.06/mondo/mondo/common/libmondo-devices.c

    r275 r305  
    25232523    strcpy(tmp,
    25242524           call_program_and_get_last_line_of_output
    2525            ("df -m -t nonfs,msdosfs,ntfs,smbfs,smb,cifs | tr -s '\t' ' ' | grep -v none | grep -v Filesystem | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2525           ("df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs | tr -s '\t' ' ' | grep -v none | grep -v Filesystem | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    25262526#else
    25272527    strcpy(tmp,
    25282528           call_program_and_get_last_line_of_output
    2529            ("df -m -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs | sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -v none | grep -v Filesystem | grep -v /dev/shm | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2529           ("df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs | sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -v none | grep -v Filesystem | grep -v /dev/shm | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    25302530#endif
    25312531
  • branches/2.06/mondo/mondo/common/libmondo-tools.c

    r275 r305  
    10141014    assert_string_is_neither_NULL_nor_zerolength(partition);
    10151015
    1016     sprintf(command, "df -m %s &> /dev/null", partition);
     1016    sprintf(command, "df -m -P %s &> /dev/null", partition);
    10171017    if (system(command)) {
    10181018        return (-1);
    10191019    }                           // partition does not exist
    1020     sprintf(command, "df -m %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
     1020    sprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
    10211021            partition);
    10221022    strcpy(out_sz, call_program_and_get_last_line_of_output(command));
  • branches/2.06/mondo/mondo/mondorestore/mondo-rstr-tools.c

    r273 r305  
    469469        strcat(mount_isodir_command, " -o ro ");
    470470        strcat(mount_isodir_command, bkpinfo->isodir);
    471         run_program_and_log_output("df -m", FALSE);
     471        run_program_and_log_output("df -P -m", FALSE);
    472472        sprintf(tmp,
    473473                "The 'mount' command is '%s'. PLEASE report this command to be if you have problems, ok?",
     
    653653    }
    654654    close_progress_form();
    655     run_program_and_log_output("df -m", TRUE);
     655    run_program_and_log_output("df -P -m", TRUE);
    656656    if (retval) {
    657657        if (g_partition_table_locked_up > 0) {
     
    679679        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
    680680    }
    681     run_program_and_log_output("df -m", 3);
     681    run_program_and_log_output("df -P -m", 3);
    682682    paranoid_free(mountlist);
    683683    paranoid_free(tmp);
     
    22392239    sort_mountlist_by_mountpoint(mountlist, 0);
    22402240
    2241     run_program_and_log_output("df -m", 3);
     2241    run_program_and_log_output("df -P -m", 3);
    22422242    mvaddstr_and_log_it(g_currentY, 0, "Unmounting devices      ");
    22432243    open_progress_form("Unmounting devices",
  • branches/2.06/mondo/mondo/restore-scripts/mondo/grub-install.patched

    r30 r305  
    257257    # For now, this uses the program `df' to get the device name, but is
    258258    # this really portable?
    259     tmp_fname=`df $1/ | sed -n 's%.*\(/dev/[^   ]*\).*%\1%p'`
     259    tmp_fname=`df -P $1/ | sed -n 's%.*\(/dev/[^    ]*\).*%\1%p'`
    260260
    261261    if test -z "$tmp_fname"; then
Note: See TracChangeset for help on using the changeset viewer.