home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / sbin / calcfreespace.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  2006-05-26  |  680 b   |  25 lines

  1. #!/bin/sh
  2. #calc free space in which to create/save files.
  3.  
  4. SIZEFREE=0
  5. PUPMODE=2
  6. [ -f /etc/rc.d/PUPMODE ] && PUPMODE=`cat /etc/rc.d/PUPMODE`
  7.  
  8. case $PUPMODE in
  9.  3|7|13) #home partition/file mntd on pup_ro1, tmpfs on pup_rw
  10.   SIZEFREE=`df -k | grep ' /initrd/pup_ro1$' | tr -s ' ' | cut -f 4 -d ' '`
  11.   SIZETMP=`df -k | grep ' /initrd/pup_rw$' | tr -s ' ' | cut -f 4 -d ' '`
  12.   [ $SIZETMP -lt $SIZEFREE ] && SIZEFREE=$SIZETMP
  13.   ;;
  14.  6|12) #home partition/file mntd on pup_rw (no tmpfs)
  15.   SIZEFREE=`df -k | grep ' /initrd/pup_rw$' | tr -s ' ' | cut -f 4 -d ' '`
  16.   ;;
  17.  *)
  18.   SIZEFREE=`df -k | grep ' /$' | tr -s ' ' | cut -f 4 -d ' '`
  19.   ;;
  20. esac
  21.  
  22. #exit $SIZEFREE
  23. echo "$SIZEFREE"
  24. ###end###
  25.