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 / Pdisk < prev    next >
Encoding:
Text File  |  2005-02-09  |  1.7 KB  |  58 lines

  1. #!/bin/sh
  2.  
  3. if [ -f /usr/sbin/cfdisk ];then
  4.  BUTMANAGE="fdisk:20,cfdisk:21"
  5. else
  6.  BUTMANAGE="fdisk:20"
  7. fi
  8.  
  9. ALLINFO="`probedisk 2>/dev/null | grep -v "cdrom|" | grep -v "/scd"`"
  10. ALLPARTS="`echo "$ALLINFO" | cut -f 1 -d "|" | cut -f 3 -d "/" | tr "\n" " "`"
  11. ALLMNTD="`df | grep "/dev/" | cut -f 1 -d " " | grep -v "loop" | tr "\n" " "`"
  12.  
  13. butval=20
  14. BUTPARTS=""
  15. for EACHPART in $ALLPARTS
  16. do
  17. BUTPARTS="${BUTPARTS}$EACHPART:$butval,"
  18. butval=`expr $butval + 1`
  19. done
  20. BUTPARTS="${BUTPARTS}EXIT:10"
  21.  
  22. xmessage -bg "#8080ff" -center -name "Pdisk" -title "Pdisk drive partition manager" -buttons $BUTPARTS "Welcome, this program enables you to run either fdisk, or, if it is
  23. installed, cfdisk. These are utility applications to examine and
  24. modify disk drive partitions. This includes creating and erasing
  25. partitions, so is not for the faint-of-heart!
  26.  
  27. Here are the disk drives that Puppy knows about:
  28. $ALLINFO
  29.  
  30. If any drive is wrong or missing, exit this program and run the
  31. \"Mount/unmount drives\" program, that you will find in the \"File 
  32. Managers\" menu. That tool will enable you to probe the hardware.
  33.  
  34. These partitions are curently mounted:
  35. $ALLMNTD
  36. ...you can view these but NOT change them.
  37.  
  38. To continue this program, click a drive button..."
  39.  
  40. RETVAL=$?
  41. if [ $RETVAL -lt 11 ];then
  42.  exit
  43. fi
  44.  
  45. EDITPART="`echo "$BUTPARTS" | tr "," "\n" | grep "$RETVAL" | cut -f 1 -d ":"`"
  46.  
  47. xmessage -bg "#80C080" -center -name "Pdisk" -title "Pdisk drive partition manager" -buttons $BUTMANAGE,EXIT:10 "Chose the partition manager program that you want to use..."
  48.  
  49. RETVAL=$?
  50. if [ $RETVAL -lt 11 ];then
  51.  exit
  52. fi
  53.  
  54. if [ $RETVAL -eq 21 ];then
  55.  rxvt -bg "#C080ff" -e cfdisk /dev/$EDITPART
  56. else
  57.  rxvt -bg "#C080ff" -e fdisk /dev/$EDITPART
  58. fi