Pdisk 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh
  2. #2007 Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html)
  3. #v3.97 BK bugfix.
  4. #110205 use probedisk2.
  5. #130203 change probedisk2 to probedisk.
  6. if [ -f /usr/sbin/cfdisk -o -f /sbin/cfdisk ];then #v3.97
  7. BUTMANAGE="fdisk:20,cfdisk:21"
  8. else
  9. BUTMANAGE="fdisk:20"
  10. fi
  11. ALLINFO="`probedisk 2>/dev/null | grep -v "optical|" | grep -v "/scd"`" #110205
  12. ALLPARTS="`echo "$ALLINFO" | cut -f 1 -d "|" | cut -f 3 -d "/" | tr "\n" " "`"
  13. ALLMNTD="`df | grep "/dev/" | cut -f 1 -d " " | grep -v "loop" | tr "\n" " "`"
  14. butval=20
  15. BUTPARTS=""
  16. for EACHPART in $ALLPARTS
  17. do
  18. BUTPARTS="${BUTPARTS}$EACHPART:$butval,"
  19. butval=`expr $butval + 1`
  20. done
  21. BUTPARTS="${BUTPARTS}EXIT:10"
  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. Here are the disk drives that Puppy knows about:
  27. $ALLINFO
  28. If any drive is wrong or missing, exit this program and run the
  29. \"Mount/unmount drives\" program, that you will find in the \"File
  30. Managers\" menu. That tool will enable you to probe the hardware.
  31. These partitions are curently mounted:
  32. $ALLMNTD
  33. ...you can view these but NOT change them.
  34. To continue this program, click a drive button..."
  35. RETVAL=$?
  36. if [ $RETVAL -lt 11 ];then
  37. exit
  38. fi
  39. EDITPART="`echo "$BUTPARTS" | tr "," "\n" | grep "$RETVAL" | cut -f 1 -d ":"`"
  40. 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..."
  41. RETVAL=$?
  42. if [ $RETVAL -lt 11 ];then
  43. exit
  44. fi
  45. if [ $RETVAL -eq 21 ];then
  46. rxvt -bg "#C080ff" -e cfdisk /dev/$EDITPART
  47. else
  48. rxvt -bg "#C080ff" -e fdisk /dev/$EDITPART
  49. fi