cdburner-wizard 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #!/bin/sh
  2. #cd-burner wizard
  3. #Barry Kauler (c) copyright 2003,2004,2005
  4. #Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html). 2007 www.puppylinux.com
  5. #updated for v1.0.5
  6. #updated for 2.17
  7. #v431 man, this script is ancient! have done some fixing.
  8. #120323 partial replace 'xmessage' with 'pupmessage'.
  9. #120507 L18L: internationalised. exit if SELECTIONS="" avoids "Usage of Xdialog"; gettext´ed
  10. #130203 change probedisk2 to probedisk.
  11. . gettext.sh
  12. export TEXTDOMAIN=cdburner-wizard
  13. export OUTPUT_CHARSET=UTF-8
  14. DRIVESFND="`probedisk`"
  15. OPTICALDRVSFND="`echo "$DRIVESFND" | grep '|optical|'`"
  16. SELECTIONS="`echo "$OPTICALDRVSFND" | cut -f 1,3 -d "|" | tr " " "_" | tr "|" " " | tr '$' "_"`"
  17. if [ -z "$SELECTIONS" ]; then #120507
  18. pupmessage -bg "red" -center -name "burnwiz" -title "$(gettext 'CD/DVD driver Wizard: FAILURE')" "$(gettext 'no optical drive found')"
  19. exit 0
  20. fi
  21. nothing="$(gettext 'nothing')"
  22. CDROMDEV=$nothing
  23. CDROMLINK=$nothing
  24. if [ -e /dev/cdrom ];then
  25. CDROMDEV="/dev/`readlink /dev/cdrom | sed -e 's%/dev/%%'`"
  26. CDROMLINK="`readlink /dev/cdrom`"
  27. fi
  28. DVDDEV=$nothing
  29. DVDLINK=$nothing
  30. if [ -e /dev/dvd ];then
  31. DVDDEV="/dev/`readlink /dev/dvd | sed -e 's%/dev/%%'`"
  32. DVDLINK="`readlink /dev/dvd`"
  33. fi
  34. MSG1="$(gettext 'Welcome to my CD and DVD Drive Wizard!')"
  35. BGCOLOR1="#ffc0c0"
  36. CHOSECD="$(gettext 'Choose_cdrom')"
  37. CHOSEDVD="$(gettext 'Choose_dvd')"
  38. while :; do
  39. xmessage -bg "$BGCOLOR1" -center -name "burnwiz" -title "$(gettext 'Optical Drive Wizard')" -buttons \
  40. "${CHOSECD}":11,"${CHOSEDVD}":20,"$(gettext 'HELP')":15,"$(gettext 'EXIT')":13 \
  41. -file -<<FILETXT
  42. $MSG1
  43. $(gettext 'Puppy has probed your PC and found these CD/DVD drives:')
  44. $SELECTIONS
  45. `eval_gettext 'Puppy thinks the default CDROM drive is: ${CDROMDEV}'`
  46. `eval_gettext 'Puppy thinks the default DVD drive is: ${DVDDEV}'`
  47. DEVICE LINKS:
  48. `eval_gettext '/dev/cdrom is currently linked to: ${CDROMLINK}.'`
  49. `eval_gettext '/dev/dvd is currently linked to: ${DVDLINK}.'`
  50. `eval_gettext 'If you disagree with these choices, click the "${CHOSECD}"
  51. or "${CHOSEDVD}" button to change the selection.'`
  52. FILETXT
  53. XREPLY=$?
  54. if [ $XREPLY -eq 11 ];then #choose cdrom
  55. BGCOLOR1="#c0e0ff"
  56. #v1.0.0
  57. CDROMD0="`Xdialog --wmclass "burnwiz" --title "$(gettext 'CD/DVD drive Wizard')" --stdout --menubox "$(gettext 'Choose which is the CDROM drive:')" 0 48 4 $SELECTIONS 2> /dev/null `"
  58. if [ ! $? -eq 0 ];then
  59. MSG1="`eval_gettext 'YOU MADE NO CHOICE FOR CDROM DRIVE, KEEPING ${CDROMDEV}'`"
  60. else
  61. MSG1="`eval_gettext 'YOU JUST CHOSE ${CDROMD0} AS THE CDROM DRIVE'`"
  62. CDROMDEV="$CDROMD0"
  63. CDROMLINK="$CDROMD0"
  64. #strip off the leading "/dev/"...
  65. echo -n $CDROMLINK | cut -f 3 -d '/' > /etc/cdromdevice
  66. rm -f /dev/cdrom
  67. ln -s $CDROMLINK /dev/cdrom
  68. fi
  69. fi
  70. if [ $XREPLY -eq 20 ];then #choose dvd
  71. BGCOLOR1="#c0e0ff"
  72. #v1.0.0
  73. DVDD0="`Xdialog --wmclass "burnwiz" --title "$(gettext 'CD/DVD drive Wizard')" --stdout --menubox "$(gettext 'Choose which is the DVD drive:')" 0 48 4 $SELECTIONS 2> /dev/null `"
  74. if [ ! $? -eq 0 ];then
  75. MSG1="`eval_gettext 'YOU MADE NO CHOICE FOR DVD DRIVE, KEEPING ${DVDDEV}'`"
  76. else
  77. MSG1="`eval_gettext 'YOU JUST CHOSE ${DVDD0} AS THE DVD DRIVE'`"
  78. DVDDEV="$DVDD0"
  79. DVDLINK="$DVDD0"
  80. #strip off the leading "/dev/"...
  81. echo -n $DVDLINK | cut -f 3 -d '/' > /etc/dvddevice
  82. rm -f /dev/dvd
  83. ln -s $DVDLINK /dev/dvd
  84. fi
  85. fi
  86. if [ $XREPLY -eq 15 ];then #help
  87. pupmessage -bg "SkyBlue" -center -title "$(gettext 'CD/DVD driver Wizard: HELP')" "$(gettext '/dev/dvd and /dev/cdrom are links to the actual devices, for example, a link to /dev/sdc. These should point to the drives that you want to read from.
  88. For example, my PC has two drives, a DVD read-only drive and a CD-burner drive.
  89. I point *both* /dev/dvd and /dev/cdrom to the DVD drive, although I could have pointed /dev/cdrom to the burner drive (a DVD drive can also read CDs, so I chose it as my default for reading both CDs and DVDs).
  90. There are various applications for reading from CD or DVD. For example, Gxine can play audio CDs and video DVDs. Some of these applications require that /dev/cdrom
  91. or /dev/dvd point to the correct devices.')"
  92. fi
  93. if [ $XREPLY -eq 13 ];then #exit
  94. break
  95. fi
  96. if [ $XREPLY -eq 0 ];then #exit
  97. break
  98. fi
  99. if [ $XREPLY -eq 1 ];then #exit
  100. break
  101. fi
  102. done
  103. ##END##