home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / cds / CDR-Toaster / cdrtoaster.txt < prev   
Text File  |  2000-07-17  |  39KB  |  1,370 lines

  1. #!/bin/sh
  2. # the next line restarts using wish \
  3.     exec wish "$0" "$@"
  4.  
  5. proc interface {} {
  6.  
  7. wm title . "CDR Toaster - 1.08"
  8.  
  9. label .title -text {CDR Toaster} -font -*-times-bold-r-*-*-30-*-*-*-*-*-*-*
  10.  
  11. frame .b -border 3 -relief raised
  12. button .b.burn -text {Have a Cook-Off}
  13.  
  14. set m .b.trick.m
  15. menubutton .b.trick -text {Do Tricks} -menu $m -relief raised -border 2
  16. menu $m -tearoff 0
  17. $m add command -label "Read CDROM to create ISO image" -command read_iso
  18. $m add command -label "Read audio tracks from CDROM" -command read_audio
  19. $m add command -label "Blank a CDRW Media" -command blank_cdrw
  20.  
  21. button .b.quit -text {Never Mind}
  22.  
  23. set m .b.help.m
  24. menubutton .b.help -text {Get Help!} -menu $m -relief raised -border 2
  25. menu $m -tearoff 0
  26. $m add command -label "About" -command help
  27. $m add command -label "Clarifications" -command help_clarify
  28.  
  29. frame .audio
  30. label .audio.la -text {Audio Track List} 
  31. frame .audio.f -border 3 -relief sunken 
  32. listbox .audio.f.lb -height 16 -width 30 -selectmode browse  -yscrollcommand {.audio.f.sb set}
  33. scrollbar .audio.f.sb -orient v -command {.audio.f.lb yview}
  34. frame .audio.m
  35. button .audio.m.up -text {Move up} -command {
  36.  set num [.audio.f.lb curselection]
  37.  if {""==$num} return
  38.  if {$num==0} return
  39.  flip $num
  40.  incr num -1
  41.  .audio.f.lb selection set $num
  42.  .audio.f.lb see $num
  43. }
  44. button .audio.m.dn -text {Move Down} -command {
  45.  set num [.audio.f.lb curselection]
  46.  if {""==$num} return
  47.  incr num 1
  48.  if {$num==[.audio.f.lb index end]} return
  49.  flip $num
  50.  .audio.f.lb selection set $num
  51.  .audio.f.lb see $num
  52. }
  53. frame .audio.ar -relief flat 
  54. button .audio.ar.add -text {Add} -command {
  55. audio_add
  56. }
  57. button .audio.ar.rem -text {Remove} -command {
  58. audio_remove
  59. }
  60. button .audio.remall -text {Remove All} -command audio_removeall
  61.  
  62. label .lds -text "Data Track Source"
  63.  
  64. frame .ds -border 3 -relief sunken 
  65. radiobutton .ds.none -text {Make audio-only disk} -variable {ds} -value none
  66. radiobutton .ds.mk -text {Make data track on the fly} -variable {ds} -value mkisofs
  67. radiobutton .ds.pre -text {Use pre-made data track} -variable {ds} -value premade
  68. entry .ds.tname -width 20 -font 7x14
  69. .ds.tname insert 0 "image.iso"
  70.  
  71. #
  72. # FIXME:
  73. # There is a missing function called my_image. It is supposed to invoke
  74. # the nice happy tk8.0+ file dialog, then populate the .ds.tname entry.
  75. # Since the function is missing, I comment out the offending code so everyone
  76. # uses the compatibility stuff.
  77. # I do not have tk8.0 so I cannot develop the other function.
  78. #
  79. ## Lets make the selection button if you have tk8.0 +
  80. #if {[info tclversion] >= 8.0} {
  81. #  button .ds.select -text {Select} -command {my_image}
  82. #} else {
  83.   button .ds.select -text {Select} -command {
  84.     perusefile
  85.     .ds.tname delete 0 end
  86.     .ds.tname insert 0 $perusedfile
  87.   }
  88. #}
  89.  
  90.  
  91. label .lm -text {Data Track Creation Options}
  92. frame .m -border 3 -relief sunken
  93.  
  94. frame .m.scan
  95. checkbutton .m.scan.all -text {All files (keep backups etc.)} -variable {all}
  96. checkbutton .m.scan.links -text {Follow SymLinks} -variable {follow}
  97.  
  98. frame .m.file
  99. checkbutton .m.file.joliet -text {Joliet support} -variable {joliet}
  100. checkbutton .m.file.trans -text {Translation Tables (old)} -variable {trans}
  101.  
  102. frame .m.rock -border 0 -relief flat 
  103. label .m.rock.l -text {Rock Ridge:}
  104. radiobutton .m.rock.none -text {None} -variable {rock} -value none
  105. radiobutton .m.rock.rational -text {Rationalized} -variable {rock} -value rat
  106. radiobutton .m.rock.literal -text {Literal} -variable {rock} -value lit
  107.  
  108. frame .m.volid -border 0
  109. label .m.volid.l -text {Volume ID (name)}
  110. entry .m.volid.e -width 32 -font 7x14
  111. frame .m.root -border 0 -relief flat
  112. label .m.root.l -text {Root of Tree}
  113. entry .m.root.e -width 24 -font 7x14
  114. button .m.root.p -text "Peruse" -command {
  115.  peruse
  116.  .m.root.e delete 0 end
  117.  .m.root.e insert 0 $perused
  118. }
  119.  
  120. frame .m.custom -border 0
  121. checkbutton .m.custom.use -text "Use Custom Layout" -variable custom(use)
  122. button .m.custom.b -text {Set Custom Layout} -command custom_layout
  123.  
  124. frame .m.boot
  125. checkbutton .m.boot.check -text "El Torito Bootable CD" -variable boot
  126. button .m.boot.opts -text "Boot Setup" -command boot_setup
  127.  
  128. label .lc -text {cdrecord options} 
  129. frame .c -border 3 -relief sunken
  130. frame .c.flag
  131. checkbutton .c.flag.dummy -text {Dummy Burn} -variable {dummy}
  132. checkbutton .c.flag.eject -text {Eject when done} -variable {eject}
  133. button .c.flag.pad -text "Padding..." -command padbox
  134. frame .c.dev -border 0 -relief flat 
  135. label .c.dev.l -text {Device} 
  136. entry .c.dev.e -width 20 -font 7x14 
  137. frame .c.speed
  138. label .c.speed.l -text "Speed:"
  139. radiobutton .c.speed.1 -text "1x" -variable speed -value 1
  140. radiobutton .c.speed.2 -text "2x" -variable speed -value 2
  141. radiobutton .c.speed.4 -text "4x" -variable speed -value 4
  142. radiobutton .c.speed.6 -text "6x" -variable speed -value 6
  143. radiobutton .c.speed.8 -text "8x" -variable speed -value 8
  144.  
  145. pack .title -side top
  146. pack .b -side top -ipadx 30 -ipady 10
  147. pack .b.burn -side left -expand 1
  148. pack .b.trick -side left -expand 1 -ipady 1 -ipadx 1
  149. pack .b.quit -side left -expand 1
  150. pack .b.help -side left -expand 1
  151. pack .audio -side right -anchor n
  152. pack .audio.la -side top
  153. pack .audio.f -side top
  154. pack .audio.f.lb -side left
  155. pack .audio.f.sb -side left -fill y
  156. pack .audio.m -side top
  157. pack .audio.m.up -side left
  158. pack .audio.m.dn -side left
  159. pack .audio.ar -side top
  160. pack .audio.ar.add -side left
  161. pack .audio.ar.rem -side left
  162. pack .audio.remall -side top
  163. pack .lds -side top
  164. pack .ds -side top -padx 5
  165. pack .ds.none -side bottom -anchor w
  166. pack .ds.mk -side bottom -anchor w
  167. pack .ds.pre -side left -anchor w
  168. pack .ds.tname -side left -anchor w
  169. pack .ds.select -side right -anchor n
  170. pack .lm -side top
  171. pack .m -side top
  172. pack .m.scan -side top -fill x
  173. pack .m.scan.all -side left
  174. pack .m.scan.links -side right
  175. pack .m.file -side top -fill x
  176. pack .m.file.joliet -side left
  177. pack .m.file.trans -side right
  178. pack .m.rock -side top -anchor w
  179. pack .m.rock.l -side left
  180. pack .m.rock.none -side left
  181. pack .m.rock.rational -side left
  182. pack .m.rock.literal -side left
  183. pack .m.volid -side top -anchor w
  184. pack .m.volid.l -side left
  185. pack .m.volid.e -side left
  186. pack .m.root -side top -anchor w -fill x
  187. pack .m.root.l -side left
  188. pack .m.root.e .m.root.p -side left
  189. pack .m.custom -side top -fill x
  190. pack .m.custom.use -side left
  191. pack .m.custom.b -side right
  192. pack .m.boot -side top -anchor w -fill x
  193. pack .m.boot.check -side left
  194. pack .m.boot.opts -side left -expand 1
  195. pack .lc -side top
  196. pack .c -side top
  197. pack .c.flag -side top
  198. pack .c.flag.dummy -side left
  199. pack .c.flag.eject -side left
  200. pack .c.flag.pad -side left
  201. pack .c.dev -side top
  202. pack .c.dev.l -side left
  203. pack .c.dev.e -side left
  204. pack .c.speed -side top
  205. pack .c.speed.l .c.speed.1 .c.speed.2 .c.speed.4 .c.speed.6 .c.speed.8 -side left
  206.  
  207. frame .spacer -height 10
  208. pack .spacer -side top
  209.  
  210. .c.dev.e insert 0 "/dev/sg0"
  211.  
  212. }
  213. proc toast {} {
  214. global apad dpad ds
  215.  
  216. if {$ds == "none"} {
  217. set source ""
  218. }
  219.  
  220. if {$ds == "premade"} {
  221.  set source [.ds.tname get]
  222.  if {![file isfile $source]} {
  223.  alert "Premade data track must be a regular file."
  224.  return
  225.  }
  226. }
  227.  
  228. if {$ds == "mkisofs"} {
  229.  set source -
  230.  set mk [make_mkisofs_cmd]
  231.  if {$mk == ""} {
  232.   return
  233.  }
  234. }
  235.  
  236. set cd [base_cdrec]
  237.  
  238. set nuke ""
  239. set convlist ""
  240.  
  241. if {$source != ""} {
  242.  lappend cd -data
  243.  if $dpad {lappend cd "-pad"}
  244.  lappend cd $source
  245. }
  246. set tmp [.audio.f.lb get 0 end]
  247. if {$tmp == ""} {
  248.  if {$ds == "none"} {
  249.   alert "No audio tracks were specified for an audio-only disk. This makes no sense."
  250.   return
  251.  }
  252. } else {
  253.  lappend cd -audio
  254.  if $apad {lappend cd "-pad"} else {
  255.   if $dpad {lappend cd "-nopad"}
  256.  }
  257.  set warned 0
  258.  foreach i $tmp {
  259.   ## Have to validate audio track type
  260.   switch [file extension $i] {
  261.    .mp2 -
  262.    .mpg -
  263.    .mp3 {
  264.     if {$warned == 0} {
  265.      # Give use opportunity to opt out. Also collect info for conversion.
  266.      set tempdir [get_mp3_burn_info]
  267.      if {$tempdir==""} {
  268.       alert "An understandable choice."
  269.       return
  270.      }
  271.      set warned 1
  272.     }
  273.     # Queue for conversion burning, and nuking.
  274.     # Yes, there are race conditions. No, I don't care too much. If
  275.     # you have a fix for the race conditions which is not too complicated,
  276.     # tell me and I'll probably add your fix. Thanks.
  277.     set tail [file tail $i]
  278.     set tempfile [file join $tempdir "###${tail}.wav"]
  279.     if [file exists $tempfile] {
  280.      alert "$tempfile already exists. I will cancel the burn and let you decide what to do."
  281.      return
  282.     }
  283.     lappend convlist $i
  284.     lappend nuke $tempfile
  285.     lappend cd $tempfile
  286.    }
  287.    
  288.    .wav -
  289.    .raw -
  290.    .pcm {
  291.     # queue for burning
  292.     lappend cd $i
  293.    }
  294.    
  295.    default {
  296.     # Note the offending file for the user.
  297.     alert "I don't recognize the file extention on '$i'. For safety reasons, I won't burn that file as an audio track.\n\nI'd suggest removing it and others like it from the audio track list."
  298.     return
  299.    }
  300.   }
  301.  }
  302. }
  303.  
  304. if {$ds == "mkisofs"} { set cd [concat $mk $cd] }
  305.  
  306. set shellCommand $cd
  307. regsub -all {///PIPE///} $shellCommand "|" shellCommand
  308.  
  309. if {[sure "About to run command:\n\n$shellCommand\n\nAre you sure?"]} {
  310.  set err 0
  311.  set err [catch {
  312.   # Run necessary conversions
  313.   if [llength $convlist] {
  314.     
  315.     toplevel .conv
  316.     wm title .conv "Converting MP3s"
  317.     text .conv.t -width 80 -height [llength $convlist]
  318.     pack .conv.t
  319.     
  320.     foreach orig $convlist tempfile $nuke {
  321.       .conv.t insert end "$orig --> $tempfile ..."
  322.       update
  323.       exec mpg123 -s $orig | sox -t raw -w -s -c 2 -r 44100 - -t wav $tempfile >&/dev/null
  324.       .conv.t insert end " Done.\n"
  325.     }
  326.     
  327.     destroy .conv
  328.   }
  329.  }]
  330.  
  331.  set cmd_list [list $cd]
  332.  
  333.  if $err {
  334.   alert "Some error occured during the MPEG conversion process. You probably ran out of space or don't have the mpg123 and sox tools installed."
  335.  } else {
  336.   # Remove temp files when done...
  337.   foreach tempfile $nuke {
  338.     lappend cmd_list [list rm $tempfile]
  339.   }
  340.   
  341.   dispatch $cmd_list {CD Burn Progress}
  342.  }
  343.  
  344. }
  345.  
  346. }
  347. proc audio_add {} {
  348. catch {destroy .add}
  349. toplevel .add
  350. wm title .add {Add Audio Tracks}
  351.  
  352.  
  353. label .add.l -text {Track Name (Globals OK)} 
  354. entry .add.e -width 32 -font 7x14 
  355. button .add.ok -text {OK} -command {
  356. set tmp [glob -nocomplain [.add.e get]]
  357. foreach i $tmp {.audio.f.lb insert end $i}
  358. destroy .add
  359. }
  360. button .add.cancel -text {Cancel} -command {
  361. destroy .add
  362. }
  363.  
  364. pack .add.l -side top
  365. pack .add.e -side top
  366. pack .add.ok -side left
  367. pack .add.cancel -side right
  368.  
  369.  
  370. }
  371. proc audio_remove {} {
  372. set victim [.audio.f.lb curselection]
  373. catch {.audio.f.lb delete $victim}
  374. }
  375. proc audio_removeall {} {
  376. .audio.f.lb delete 0 end
  377. }
  378. proc flip n {
  379. .audio.f.lb selection clear 0 end
  380. set above [expr $n - 1]
  381. set tmp [.audio.f.lb get $n]
  382. .audio.f.lb insert $above $tmp
  383. .audio.f.lb delete [expr $n + 1]
  384. }
  385. proc alert msg {
  386. tk_dialog .alert Alert $msg info 0 "So it goes."
  387. }
  388. proc help {} {
  389. catch {destroy .help}
  390. toplevel .help
  391. wm title .help {Help!}
  392.  
  393. button .help.ok -text {This Rules!} -command {destroy .help}
  394. text .help.t -width 60 -height 18 -yscrollcommand {.help.sb set} -wrap word
  395. scrollbar .help.sb -orient v -command {.help.t yview}
  396.  
  397. pack .help.ok -side bottom
  398. pack .help.t -side left
  399. pack .help.sb -side left -fill y
  400.  
  401. .help.t insert 1.0 {About CDR-Toaster version 1.08
  402.  
  403. This is a graphical front-end for the excelent programs 'mkisofs', 'cdrecord', and 'cdparanoia'.
  404.  
  405. It's good for:
  406.  o Avoiding coasters due to command-line mistakes
  407.  o Eliminating the tedium of consulting documentation
  408.  o Feeling more secure in a correct set of options
  409.  o Being lazy
  410.  
  411. As you can guess, I wrote it for what it's good for.
  412.  
  413. CDR-Toaster is copyright 1999 Ian Kjos <brooke@jump.net>
  414.  
  415. CDR-Toaster contains some code contributed by:
  416.   Andrew Williams <woodchuk@bellatlantic.net>
  417.  
  418. CDR-Toaster is availible under the GNU General
  419. Public License version 2.0 or later (at your option).
  420. This license can be found at 
  421. http://www.gnu.org/copyleft/gpl.html
  422.  
  423. }
  424.  
  425. .help.t config -state disabled
  426.  
  427. }
  428. proc sure msg {
  429. return [expr ![tk_dialog .alert Confirmation $msg questhead -1 yes no]]
  430. }
  431. proc read_iso {} {
  432. catch {destroy .top}
  433. toplevel .top
  434. wm title .top "Read ISO image"
  435.  
  436. frame .top.dev -border 0 -relief flat 
  437. frame .top.file -border 0 -relief flat 
  438. frame .top.b -border 0 -relief flat 
  439. label .top.dev.l -text {device to read:} 
  440. label .top.file.l -text {file to write:} 
  441. entry .top.dev.e -width 20 -font 7x14 
  442. entry .top.file.e -width 20 -font 7x14 
  443. button .top.b.ok -text {Do it} -command {
  444. if {![file readable [.top.dev.e get]]} {
  445.  alert "You do not have read permissions on '[.top.dev.e get]'. You should probably be running this as root."
  446.  return
  447. }
  448. set tmp "echo 'This takes a good while.';dd if=[.top.dev.e get] of=[.top.file.e get] bs=1024k; eject [.top.dev.e get]"
  449. dispatch [list $tmp] "Reading ISO Image"
  450. destroy .top
  451. }
  452. button .top.b.dis -text {Forget it} -command {
  453. destroy .top
  454. }
  455.  
  456. pack .top.dev -side top
  457. pack .top.file -side top
  458. pack .top.b -side top -fill x
  459. pack .top.dev.l -side left
  460. pack .top.file.l -side left
  461. pack .top.dev.e -side left
  462. pack .top.file.e -side left
  463. pack .top.b.ok -side left -expand 1
  464. pack .top.b.dis -side left -expand 1
  465.  
  466. .top.dev.e insert 0 "/dev/cdrom"
  467. .top.file.e insert 0 "image.iso"
  468.  
  469. }
  470. proc read_audio {} {
  471. catch {destroy .top}
  472. toplevel .top
  473. wm title .top "Read audio tracks"
  474.  
  475. frame .top.path
  476. label .top.path.l -text "Rip Destination: "
  477. entry .top.path.dest
  478. button .top.path.peruse -text "Peruse" -command {
  479. peruse
  480. .top.path.dest delete 0 end
  481. .top.path.dest insert 0 $perused
  482. }
  483.  
  484. frame .top.1 -border 0 -relief flat 
  485. frame .top.2 -border 0 -relief flat 
  486. frame .top.3 -border 0 -relief flat 
  487. frame .top.4 -border 0 -relief flat 
  488. radiobutton .top.1.entire -text {Rip Entire Disk} -variable {rip} -value {all}
  489. radiobutton .top.2.track -text {Tracks:} -variable {rip} -value {track}
  490. radiobutton .top.3.custom -text {Custom Options} -variable {rip} -value {custom}
  491. button .top.4.ok -text {Do it} -command {
  492.  set tmp "Ripping Audio"
  493.  switch $rip {
  494.   all {
  495.    set dp [list "cdparanoia -s -w -B 1-"]
  496.   }
  497.   track {
  498.    set dp [list "cdparanoia -s -w -B [.top.2.from get]-[.top.2.to get]"]
  499.   }
  500.   custom {
  501.    set dp [list ["cdparanoia [.top.3.opt get]"]
  502.   }
  503.  }
  504.  if {[.top.path.dest get] != ""} {
  505.   set dp [concat [list "cd [.top.path.dest get]"] $dp]
  506.  }
  507.  dispatch $dp $tmp
  508.  destroy .top
  509. }
  510. button .top.4.dis -text {Not now.} -command {
  511.  destroy .top
  512. }
  513. label .top.2.lfr -text {From:} 
  514. entry .top.2.from -width 4 -font 7x14 
  515. label .top.2.lto -text {To:} 
  516. entry .top.2.to -width 4 -font 7x14 
  517. entry .top.3.opt -width 20 -font 7x14 
  518.  
  519. pack .top.path -side top -fill x
  520. pack .top.path.l .top.path.dest .top.path.peruse -side left
  521. pack .top.1 -side top -fill x
  522. pack .top.2 -side top -fill x
  523. pack .top.3 -side top -fill x
  524. pack .top.4 -side top -fill x
  525. pack .top.1.entire -side left -anchor w
  526. pack .top.2.track -side left -anchor w
  527. pack .top.3.custom -side left -anchor w
  528. pack .top.4.ok -side left -expand 1
  529. pack .top.4.dis -side left -expand 1
  530. pack .top.2.lfr -side left -anchor e
  531. pack .top.2.from -side left -anchor e
  532. pack .top.2.lto -side left -anchor e
  533. pack .top.2.to -side left -anchor e
  534. pack .top.3.opt -side left -anchor e
  535.  
  536. global rip
  537. set rip all
  538.  
  539.  
  540. }
  541. proc blank_cdrw {} {
  542. global blank
  543.  
  544. catch {destroy .top}
  545. toplevel .top
  546. wm title .top "Blank CDRW Media"
  547.  
  548. frame .top.type -border 0 -relief flat 
  549. frame .top.b -border 0 -relief flat 
  550. label .top.type.l -text {Blank Type} 
  551. frame .top.type.r
  552. radiobutton .top.type.all -text {Entire Disk} -variable {blank} -value {all}
  553. radiobutton .top.type.session -text {Session} -variable {blank} -value {session}
  554. radiobutton .top.type.track -text {Track} -variable {blank} -value {track}
  555. radiobutton .top.type.fast -text {Fast} -variable {blank} -value {fast}
  556. radiobutton .top.type.r.unreserve -text {Unreserve} -variable {blank} -value {unreserve}
  557. radiobutton .top.type.r.trtail -text {Track Tail} -variable {blank} -value {trtail}
  558. radiobutton .top.type.r.unclose -text {Unclose} -variable {blank} -value {unclose}
  559. button .top.b.ok -text {Do it} -command {
  560.  set cmd [base_cdrec]
  561.  lappend cmd "blank=${blank}"
  562.  dispatch [list $cmd] "Blanking CDRW: ${blank}"
  563.  destroy .top
  564. }
  565. button .top.b.dis -text {Let's not.} -command {
  566.  destroy .top
  567. }
  568.  
  569. pack .top.type -side top
  570. pack .top.b -side top -fill x
  571. pack .top.type.l -side left
  572. pack .top.type.r -side right -fill y
  573. pack .top.type.all -side top -anchor w
  574. pack .top.type.session -side top -anchor w
  575. pack .top.type.track -side top -anchor w
  576. pack .top.type.fast -side top -anchor w
  577. pack .top.type.r.unreserve -side top -anchor w
  578. pack .top.type.r.trtail -side top -anchor w
  579. pack .top.type.r.unclose -side top -anchor w
  580. pack .top.b.ok -side left -expand 1
  581. pack .top.b.dis -side left -expand 1
  582.  
  583. set blank session
  584.  
  585. }
  586. proc dispatch {cmdList title} {
  587.  
  588.  set shellCommand ""
  589.  
  590.  foreach cmd $cmdList {
  591.    set tmp [join $cmd "' '"]
  592.    append shellCommand "'$tmp'; "
  593.  }
  594.  
  595.  regsub -all {\'///PIPE///\'} $shellCommand "|" shellCommand
  596.  
  597.  append shellCommand "echo Done. Press Enter; read"
  598.  
  599.  puts $shellCommand
  600.  
  601.  exec /usr/X11R6/bin/xterm -geometry 80x6 -title $title -e sh -c $shellCommand &
  602.  
  603. }
  604. proc base_cdrec {} {
  605. global dummy eject speed
  606. set cd [list cdrecord -v]
  607. if {$dummy} {lappend cd -dummy}
  608. if {$eject} {lappend cd -eject}
  609. set dev [.c.dev.e get]
  610. if {![check_device $dev]} {
  611.  alert "You don't have write permission to the device you selected. You should probably be running this as root. If that is not an option, get the system administrator to give you write privileges for the cd-writer."
  612.  return -code return
  613. }
  614. lappend cd "dev=$dev" "speed=$speed"
  615. return $cd
  616. }
  617. proc help_clarify {} {
  618. catch {destroy .help}
  619. toplevel .help
  620. wm title .help {Help!}
  621.  
  622. set helpstuff {
  623.  {All Files}
  624. {   Ordinarily files with names contataing '#' or '~'
  625.    are backup files on Linux. CDR-Toaster will instruct
  626.    mkisofs to skip these files in the creation of a
  627.    CD. If you DON'T want to skip them, click this box.
  628. }
  629.  {Joliet support}
  630. {   This stores long filenames on a CD so Windows 9x/NT
  631.    machines can read them. Unlike the Joliet CDs produced
  632.    on MS-Windows, you can still see the 8.3 filenames on
  633.    MS-Dos and other systems that don't support Joliet.
  634.    Linux kernels 2.2 and up can also read Joliet names.
  635. }
  636.  {Rock Ridge}
  637. {   This is another way to store long filenames on a CD.
  638.    It works with all Un*x-like systems that also support
  639.    CDs. It allows file permissions, ownership info, and
  640.    symbolic links to be stored and appear as such on the
  641.    CD. If you choose "Literal", the final CD will look in
  642.    all respects identical to the directory hierarchy it
  643.    was created from, except for some reason you can't
  644.    write to it. This could be good for system backups.
  645.    If you choose "Rationalized", you get a more generally
  646.    useful CD. It sets the user and group of all files to
  647.    root, removes SUID and SGID bits, makes all files and
  648.    folders readable globally, sets all execute bits for
  649.    anything that has any execute bits, and clears all
  650.    write bits.
  651. }
  652.  {Follow SymLinks}
  653. {   Normally symbolic links are ignored, unless you use
  654.    Rock Ridge, when they are copied literally. If you
  655.    want the actual files and folders pointed to by the
  656.    symbolic links to show up on the CD, check this box.
  657. }
  658.  {Translation Tables}
  659. {   Puts a file called "TRANS.TBL" in every directory on
  660.    the CD which maps 8.3 files to their long equivalents.
  661.    Very simple, very old.
  662. }
  663.  {MPEG Compressed Audio}
  664. {   CDR-Toaster will extract MPEG Compressed audio (mp3)
  665.    if you have mpg123 and sox installed. This way you
  666.    can burn an audio CD from mp3 files. The sound will
  667.    not be as good quality as the original uncompressed
  668.    audio, but that's the trade off that a lossy compression
  669.    like MPEG makes to attain the high ratios that it does.
  670.    For more information, point your web browser at these:
  671.    http://www.mpeg.org/MPEG/
  672.    http://drogo.cselt.stet.it/mpeg/
  673. }
  674.  {PCM vs. WAV}
  675. {   WAV is a format composed of 44 bytes of header data,
  676.    then raw PCM data. PCM means only pulse code modulation,
  677.    which is to say a digitial audio format made of numbers
  678.    to signify each sample. There is no attempt made to
  679.    compress the signals beyond the decisions of sample rate
  680.    and dynamic range.
  681.  
  682.    For CDR-Toaster to burn audio, you can feed it either a
  683.    raw PCM file or a WAV file. WAV files are better because
  684.    they contain enough information in the header to ensure
  685.    that the audio format is correct. To get an audio track
  686.    to burn properly, the PCM data needs to be composed of
  687.    exactly the same structure as on a CD - that is 41.1 khz
  688.    16 bit stereo. Anything else and you get an unusable
  689.    audio track.
  690.  
  691.    When using WAV files ripped from a CD, (as CDPARANOIA
  692.    does) you will get files that are already correct. If
  693.    you want to use a WAV file you recorded yourself, it is
  694.    wise to ensure you recorded cd-quality (16 bit stereo
  695.    44.1khz) uncompressed audio. If you did otherwise, there
  696.    are many format converters availible which can convert to
  697.    this format without any signal loss. The other issue with
  698.    audio files you record yourself is that they must be a
  699.    precise multiple of 1/75th of a second. This is where
  700.    audio padding comes into play. If you do not have the
  701.    right number of samples, the Pad Audio option can round
  702.    up using absolute silence.
  703. }
  704.  {Burning Bootable CDs}
  705. {   When your computer boots from a CD, it treats part of
  706.    the CD as a floppy drive. The emulation is at the BIOS
  707.    level, so programs like the Linux Kernel operate
  708.    normally but programs like LILO or SYSLINUX are fooled.
  709.    All attempts to access the (primary) floppy drive are
  710.    mapped to the "BOOT" extent on the CD.
  711.  
  712.    Step by step, the easiest way to make a bootable CD
  713.    is as follows:
  714.  
  715.    1. Make a real live floppy disk that boots your computer
  716.       ok. There are many rescue disk packages which are
  717.       good for this purpose, or you can use your operating
  718.       system install disk. Make sure the floppy actually
  719.       boots properly.
  720.  
  721.    2. Copy this floppy disk to an image file. Under Linux
  722.       you can type:
  723.          dd if=/dev/fd0 of=bootimage.bin bs=18k
  724.  
  725.    3. Put this file in the directory you are going to make
  726.       your CD from:
  727.          mv bootimage.bin /tmp/my_cdrom/
  728.  
  729.    4. Bring up CDR-Toaster. Put a check in the "El Torito
  730.       Bootable CD" box, and click the "Boot Setup" button.
  731.  
  732.    5. For "Boot Image Path" type "bootimage.bin"
  733.  
  734.    6. For "Boot Catalog Path" type "bootcat.bin"
  735.  
  736.    7. Click OK, and set the "Root of Tree" appropriately.
  737.       From the example above, it would be "/tmp/my_cdrom"
  738.  
  739.    8. Finish burning your CD as you would normally.
  740.  
  741.    9. Set your bios to boot from CD, and things should
  742.       be happy.
  743.  
  744.    The Boot Catalog is a place for information about the
  745.    Boot Image. It is generated automatically. It need not
  746.    exist beforehand. In fact, if it does exist, it will
  747.    be overwritten.
  748.  
  749.    Both paths are interpretted relative to the root
  750.    of the CD.
  751.  
  752.    For more information, see "man mkisofs". It should be on
  753.    your system for CDR-Toaster to operate properly.
  754. }
  755.  {Using ATAPI CDR(W) Devices}
  756. {   ATAPI CDR(W)s are special. The Linux kernel needs to be 
  757.    compiled specially for them to work properly.
  758.  
  759.    Basically, you must TURN OFF IDE CDROM support and 
  760.    instead use both "SCSI emulation" and "SCSI generic 
  761.    support".
  762.  
  763.    If you have never compiled a kernel before, you are wise 
  764.    to read the Kernel Howto.
  765.  
  766.    I tend to use "make menuconfig" to configure the kernel, 
  767.    and these are the things I did:
  768.  
  769.    Under "Block devices", I set "Include IDE/ATAPI CDROM 
  770.    support" to "n" and I set "SCSI emulation support" to 
  771.    "Y".
  772.  
  773.    Under "SCSI support", I make sure there is "SCSI CD-ROM 
  774.    support" and "SCSI generic support" turned on. Since I 
  775.    have no true SCSI cards, I need nothing from the "SCSI 
  776.    low-level drivers" section.
  777.  
  778.    I built and installed this kernel. As a result, my 
  779.    CD-ROM detected as a scsi device (/dev/scd0 in my case) 
  780.    during bootup and I have been able to burn to /dev/sg0 
  781.    as is the default in CDR-Toaster.
  782.  
  783.    For more information on the special needs of your 
  784.    CDR(W), see the documentation for "cdrecord" which is 
  785.    the burn program that CDR-Toaster calls out to.
  786. }
  787. }
  788.  
  789. frame .help.b
  790.  
  791. set m .help.b.topic.m
  792. menubutton .help.b.topic -menu $m -text Topic -relief raised
  793. menu $m
  794.  
  795. button .help.b.ok -text {This Rules!} -command {destroy .help}
  796. text .help.t -width 60 -height 18 -yscrollcommand {.help.sb set} -wrap word
  797. scrollbar .help.sb -orient v -command {.help.t yview}
  798.  
  799. pack .help.b -side bottom -fill x
  800. pack .help.b.topic -side left
  801. pack .help.b.ok -side bottom
  802. pack .help.t -side left
  803. pack .help.sb -side left -fill y
  804.  
  805. .help.t insert 1.0 {Clarifications:
  806.  
  807. }
  808.  
  809. foreach {topic body} $helpstuff {
  810.  set end [.help.t index end]
  811.  set line [expr $end - 1]
  812.  $m add command -label $topic -command ".help.t yview $line"
  813.  .help.t insert end " o $topic\n"
  814.  .help.t insert end "$body\n"
  815.  .help.t tag add head $line $end
  816. }
  817.  
  818. .help.t tag configure head -foreground white -background blue -font 8x16
  819.  
  820. .help.t tag add top 1.0 2.0
  821. .help.t tag config top -foreground white -background blue -font 10x20
  822.  
  823. .help.t config -state disabled
  824.  
  825. }
  826. proc padbox {} {
  827.  
  828. catch {destroy .pad}
  829. toplevel .pad
  830. wm title .pad {Padding Options}
  831.  
  832. frame .pad.audio
  833. checkbutton .pad.audio.cb -text {Pad Audio Tracks} -variable {apad}
  834. message .pad.audio.amesg -text {This option will pad audio track data to be a multiple of 2352 bytes. The padding is done with all zeroes which means complete silence. See also PCM vs. WAV in help.
  835. }
  836. frame .pad.data
  837. checkbutton .pad.data.cb -text {Pad Data Track} -variable {dpad}
  838. message .pad.data.dmesg -text {This option appends 15 sectors of zeroes to each data track. This works around a bug in very old Linux kernels.}
  839. button .pad.ok -text Dismiss -command {destroy .pad}
  840.  
  841. pack .pad.audio -fill x
  842. pack .pad.audio.cb -side left -anchor n
  843. pack .pad.audio.amesg
  844. pack .pad.data -fill x
  845. pack .pad.data.cb -side left -anchor n
  846. pack .pad.data.dmesg
  847. pack .pad.ok
  848.  
  849. }
  850. proc peruse {} {
  851. # Just browse directories
  852.  
  853. global perused
  854.  
  855. set perused ""
  856.  
  857. catch {destroy .peruse}
  858. toplevel .peruse
  859. wm title .peruse {Peruse Folders}
  860.  
  861. frame .peruse.dir -border 0 -relief flat 
  862. frame .peruse.mod -border 0 -relief flat 
  863. frame .peruse.control -border 0 -relief flat
  864. menubutton .peruse.dir.up -menu .peruse.dir.up.m -relief raised -border 2
  865. button .peruse.dir.ok -text {<-- Accept} -command {
  866. }
  867. listbox .peruse.mod.lb -height 10 -width 20 -selectmode browse -yscrollcommand {.peruse.mod.sb set}
  868. scrollbar .peruse.mod.sb -orient v -command {.peruse.mod.lb yview}
  869. button .peruse.control.go -text {Delve} -command {
  870. }
  871. button .peruse.control.cancel -text {Cancel} -command {
  872. }
  873.  
  874. pack .peruse.dir -side top -fill x
  875. pack .peruse.mod -side top -fill x
  876. pack .peruse.control -side top -fill x
  877. pack .peruse.dir.up -side left
  878. pack .peruse.dir.ok -side right
  879. pack .peruse.mod.lb -side left -fill y -anchor w
  880. pack .peruse.mod.sb -side left -fill y -anchor w
  881. pack .peruse.control.go -side left -expand 1
  882. pack .peruse.control.cancel -side left -expand 1
  883.  
  884. peruse_populate [pwd]
  885. tkwait window .peruse
  886.  
  887. }
  888. proc perusefile {} {
  889. # Just browse files
  890.  
  891. global perusedfile
  892.  
  893. set perusedfile ""
  894.  
  895. catch {destroy .perusefile}
  896. toplevel .perusefile
  897. wm title .perusefile {Peruse Files}
  898.  
  899. frame .perusefile.dir -border 0 -relief flat 
  900. frame .perusefile.mod -border 0 -relief flat 
  901. frame .perusefile.control -border 0 -relief flat
  902. menubutton .perusefile.dir.up -menu .perusefile.dir.up.m -relief raised -border 2
  903. button .perusefile.dir.ok -text {<-- Accept} -command {
  904. }
  905. listbox .perusefile.mod.lb -height 10 -width 20 -selectmode browse -yscrollcommand {.perusefile.mod.sb set}
  906. scrollbar .perusefile.mod.sb -orient v -command {.perusefile.mod.lb yview}
  907. button .perusefile.control.go -text {Delve} -command {
  908. }
  909. button .perusefile.control.cancel -text {Cancel} -command {
  910. }
  911.  
  912. pack .perusefile.dir -side top -fill x
  913. pack .perusefile.mod -side top -fill x
  914. pack .perusefile.control -side top -fill x
  915. pack .perusefile.dir.up -side left
  916. pack .perusefile.dir.ok -side right
  917. pack .perusefile.mod.lb -side left -fill y -anchor w
  918. pack .perusefile.mod.sb -side left -fill y -anchor w
  919. pack .perusefile.control.go -side left -expand 1
  920. pack .perusefile.control.cancel -side left -expand 1
  921.  
  922. perusefile_populate [pwd]
  923. tkwait window .perusefile
  924.  
  925. }
  926. proc peruse_populate dir {
  927.  
  928. set tmp [file tail $dir]
  929. if {$tmp == ""} {set tmp /}
  930. .peruse.dir.up configure -text $tmp
  931.  
  932. set m .peruse.dir.up.m
  933. catch {
  934. destroy $m
  935. }
  936. menu $m -tearoff 0
  937.  
  938. set up /
  939. foreach dcomp [file split $dir] {
  940.  set up [file join $up $dcomp]
  941.  $m add command -label $dcomp -command "peruse_populate \"$up\""
  942. }
  943.  
  944. .peruse.mod.lb delete 0 end
  945. set tmp [lsort [glob $dir/.* $dir/*]]
  946. foreach dcan $tmp {
  947.  if [file isdirectory $dcan] {
  948.   set tail [file tail $dcan]
  949.   if {$tail != "." && $tail != ".."} {
  950.    .peruse.mod.lb insert end $tail
  951.   }
  952.  }
  953. }
  954.  
  955. ## Bindings
  956.  
  957. .peruse.control.cancel config -command {
  958.  set perused ""
  959.  destroy .peruse
  960. }
  961. .peruse.dir.ok config -command [subst {
  962.  set perused "$dir"
  963.  destroy .peruse
  964. }]
  965.  
  966. set go [subst -nocommands {
  967.  if {[.peruse.mod.lb get active] != ""} {
  968.   peruse_populate [file join "$dir" [.peruse.mod.lb get active]]
  969.  } else bell
  970. }]
  971.  
  972. bind .peruse.mod.lb <Double-1> $go
  973. .peruse.control.go config -command $go
  974.  
  975. }
  976. proc perusefile_populate dir {
  977.  
  978. set tmp [file tail $dir]
  979. if {$tmp == ""} {set tmp /}
  980. .perusefile.dir.up configure -text $tmp
  981.  
  982. set m .perusefile.dir.up.m
  983. catch {
  984. destroy $m
  985. }
  986. menu $m -tearoff 0
  987.  
  988. set up /
  989. foreach dcomp [file split $dir] {
  990.  set up [file join $up $dcomp]
  991.  $m add command -label $dcomp -command "perusefile_populate \"$up\""
  992. }
  993.  
  994. .perusefile.mod.lb delete 0 end
  995. if {[catch {lsort [glob $dir/.* $dir/*]} catchvar]} {
  996.   set tmp ""
  997. } else {
  998.   set tmp $catchvar
  999. }
  1000.  
  1001. foreach dcan $tmp {
  1002.   set tail [file tail $dcan]
  1003.   if {$tail != "." && $tail != ".."} {
  1004.    .perusefile.mod.lb insert end $tail
  1005.   }
  1006. }
  1007.  
  1008. ## Bindings
  1009.  
  1010. .perusefile.control.cancel config -command {
  1011.  set perusedfile ""
  1012.  destroy .perusefile
  1013. }
  1014. .perusefile.dir.ok config -command [subst {
  1015.  set perusedfile "$dir"
  1016.  destroy .perusefile
  1017. }]
  1018.  
  1019. set go [subst -nocommands {
  1020.  if {[.perusefile.mod.lb get active] != ""} {
  1021.   perusefile_populate [file join "$dir" [.perusefile.mod.lb get active]]
  1022.  } else bell
  1023. }]
  1024.  
  1025. bind .perusefile.mod.lb <Double-1> $go
  1026. .perusefile.control.go config -command $go
  1027.  
  1028. }
  1029. proc boot_setup {} {
  1030. global bootimg bootcat
  1031.  
  1032. catch {destroy .boot}
  1033. toplevel .boot
  1034. wm title .boot {Bootable CD Setup}
  1035.  
  1036.  
  1037. frame .boot.img -border 0 -relief flat 
  1038. frame .boot.cat -border 0 -relief flat 
  1039. frame .boot.cmd -border 0 -relief flat 
  1040. label .boot.img.l -text {Boot Image Path} 
  1041. label .boot.cat.l -text {Boot Catalog Path} 
  1042. entry .boot.img.e -width 20 -font 7x14 
  1043. entry .boot.cat.e -width 20 -font 7x14 
  1044.  
  1045. # Got TK8? You get a pretty button.
  1046. if {[info tclversion] >= 8.0} {
  1047.   button .boot.img.b -text {Select} -command open_bootfile
  1048.   button .boot.cat.c -text {Select} -command open_catfile
  1049. }
  1050.  
  1051. button .boot.cmd.ok -text {OK} -command {
  1052.  set bootimg [.boot.img.e get]
  1053.  set bootcat [.boot.cat.e get]
  1054.  destroy .boot
  1055. }
  1056. button .boot.cmd.cancel -text {Cancel} -command {
  1057.  destroy .boot
  1058. }
  1059. button .boot.cmd.revert -text {Revert} -command {
  1060.  .boot.img.e delete 0 end
  1061.  .boot.cat.e delete 0 end
  1062.  .boot.img.e insert 0 $bootimg
  1063.  .boot.cat.e insert 0 $bootcat
  1064. }
  1065.  
  1066. # Populate Data Fields
  1067. .boot.img.e insert 0 $bootimg
  1068. .boot.cat.e insert 0 $bootcat
  1069.  
  1070. pack .boot.img -side top -fill x
  1071. pack .boot.cat -side top -fill x
  1072. pack .boot.cmd -side top -fill x
  1073. pack .boot.img.l -side left
  1074. pack .boot.cat.l -side left
  1075. pack .boot.img.e -side right
  1076. pack .boot.cat.e -side right
  1077. pack .boot.cmd.ok -side left -expand 1
  1078. pack .boot.cmd.cancel -side left -expand 1
  1079. pack .boot.cmd.revert -side left -expand 1
  1080.  
  1081. # Got TK8? You get a pretty button.
  1082. if {[info tclversion] >= 8.0} {
  1083.   pack .boot.img.b -side right
  1084.   pack .boot.cat.c -side right
  1085. }
  1086.  
  1087. # frame .m.img
  1088. # label .m.img.l -text "Boot Image Path"
  1089. # entry .m.img.e
  1090. # frame .m.cat
  1091. # label .m.cat.l -text "Boot Catalog Path"
  1092. # entry .m.cat.e
  1093. }
  1094. proc get_mp3_burn_info {} {
  1095. # Returns either the empty list, indicating a cancelation,
  1096. # or the temp directory.
  1097.  
  1098. global perused
  1099.  
  1100. set warn {\
  1101. You have chosen to burn an MPEG compressed file as an audio track. This will not be the same quality as the original from which it was made. However, the burn can proceed if given a space to uncompress the audio files.
  1102.  
  1103. Do you wish to proceed?}
  1104.  
  1105. set go [sure $warn]
  1106. if {!$go} {
  1107.  return {}
  1108. }
  1109.  
  1110. set df [exec -keepnewline df]
  1111.  
  1112. catch {destroy .df}
  1113. toplevel .df
  1114. wm title .df {Free Disk Space}
  1115.  
  1116. text .df.t -width 80 -height 10 -setgrid 1 -yscrollcommand {.df.sb set}
  1117. scrollbar .df.sb -orient v -command {.df.t yview}
  1118.  
  1119. .df.t insert end "Please browse to a directory with sufficient free space.\n\n"
  1120. .df.t insert end $df
  1121. .df.t config -state disabled
  1122.  
  1123. pack .df.sb -side right -fill y
  1124. pack .df.t -side left
  1125.  
  1126. peruse
  1127. destroy .df
  1128.  
  1129. alert "Be aware that the MP3 conversion process typically takes some time."
  1130.  
  1131. return $perused
  1132. }
  1133. proc custom_layout {} {
  1134.  
  1135. global custom
  1136.  
  1137. catch {destroy .custom}
  1138. toplevel .custom
  1139. wm title .custom {Custom CD Layout}
  1140.  
  1141.  
  1142. frame .custom.dirs -border 0 -relief flat 
  1143. frame .custom.table -border 0 -relief flat 
  1144. frame .custom.cmds -border 0 -relief flat 
  1145. frame .custom.help -border 0 -relief flat 
  1146. label .custom.dirs.a -text {Make contents of:} 
  1147. label .custom.dirs.b -text {Show up on CD within:} 
  1148.  
  1149. foreach x {0 1 2 3 4 5 6 7 8 9} {
  1150.  frame .custom.table.$x -border 0 -relief flat 
  1151.  button .custom.table.$x.peruse -text {Peruse} -command "custom_peruse $x"
  1152.  entry .custom.table.$x.from -width 25 -font 7x14 
  1153.  entry .custom.table.$x.to -width 25 -font 7x14 
  1154.  
  1155.  button .custom.table.$x.clear -text {Clear} -command [subst {
  1156.  .custom.table.$x.from delete 0 end
  1157.  .custom.table.$x.to delete 0 end
  1158.  }]
  1159.  
  1160.  pack .custom.table.$x -side top -fill x
  1161.  pack .custom.table.$x.peruse -side left -anchor w
  1162.  pack .custom.table.$x.from -side left -anchor w
  1163.  pack .custom.table.$x.clear -side right -anchor e
  1164.  pack .custom.table.$x.to -side right -anchor e
  1165.  
  1166. }
  1167.  
  1168. scrollbar .custom.help.sb -orient v -command {} -command {.custom.help.t yview}
  1169. text .custom.help.t -width 70 -height 10 -setgrid 1 -yscrollcommand {.custom.help.sb set}
  1170. button .custom.cmds.ok -text {OK} -command {
  1171.  set from {}
  1172.  set to {}
  1173.  foreach s [pack slaves .custom.table] {
  1174.   lappend from [$s.from get]
  1175.   lappend to [$s.to get]
  1176.  }
  1177.  set custom(from) $from
  1178.  set custom(to) $to
  1179.  set custom(use) 1
  1180.  destroy .custom
  1181. }
  1182. button .custom.cmds.revert -text {Revert} -command {
  1183.  foreach s [pack slaves .custom.table] from $custom(from) to $custom(to) {
  1184.   $s.from delete 0 end
  1185.   $s.to delete 0 end
  1186.   $s.from insert 0 $from
  1187.   $s.to insert 0 $to
  1188.  }
  1189. }
  1190. button .custom.cmds.cancel -text {Cancel} -command {
  1191. destroy .custom
  1192. }
  1193.  
  1194. pack .custom.dirs -side top -fill x
  1195. pack .custom.table -side top -fill x
  1196. pack .custom.cmds -side top -fill x
  1197. pack .custom.help -side top -fill both -expand 1
  1198. pack .custom.dirs.a -side left -anchor w
  1199. pack .custom.dirs.b -side right -anchor e
  1200. pack .custom.help.sb -side right -fill y -anchor e
  1201. pack .custom.help.t -side right -fill both -anchor w
  1202. pack .custom.cmds.ok -side left -expand 1
  1203. pack .custom.cmds.revert -side left -expand 1
  1204. pack .custom.cmds.cancel -side left -expand 1
  1205.  
  1206. .custom.cmds.revert invoke
  1207.  
  1208. .custom.help.t insert 1.0 {              Custom CD Layout Help
  1209.  
  1210. This was always the biggest pain for me. I want stuff from the hard
  1211. drive from arbitrary places to show up on the final CD in (other)
  1212. arbitrary places.
  1213.  
  1214. I've tried to make this fairly general. Name what you want on the
  1215. left, and where to put it on the right. The one thing to remember
  1216. is that if you put a directory on the left, you have to give it
  1217. a name on the right unless you want a whole bunch of files sprayed
  1218. all over the root of the CD.
  1219.  
  1220. The names you give on the right do not have to exist anywhere
  1221. except your imagination. If they don't exist within other parts of
  1222. what you burn, the directories will be automatically created to
  1223. exist on the CD. Directories created in this way will be owned by
  1224. root.root and have permissions 555 (read/exec for all).
  1225.  
  1226. I'm not yet sure how these custom layouts interact with bootable
  1227. CD creation. I think that you specify the boot paths relative to
  1228. the final CD image. I know it works that way in the simple case.
  1229.  
  1230. }
  1231.  
  1232. .custom.help.t tag add cool 1.0 2.0
  1233. .custom.help.t tag config cool -font 10x20
  1234. .custom.help.t tag config cool -background blue
  1235. .custom.help.t tag config cool -foreground white
  1236.  
  1237. .custom.help.t config -state disabled
  1238. }
  1239. proc custom_peruse x {
  1240. global perused
  1241. peruse
  1242. if {$perused != ""} {
  1243.   .custom.table.$x.from delete 0 end
  1244.   .custom.table.$x.from insert 0 $perused
  1245. }}
  1246. proc make_mkisofs_cmd {} {
  1247.  global all joliet follow trans ds rock
  1248.  global boot bootimg bootcat custom
  1249.  
  1250.  set vol [.m.volid.e get]
  1251.  set root [.m.root.e get]
  1252.  
  1253.  # Presumably this is not necessary if there is a custom layout.
  1254.  
  1255.  if {![file isdirectory $root]} {
  1256.  alert "For on-the-fly ISO image creation, the root of tree must be a directory."
  1257.  return
  1258.  }
  1259.  
  1260.  set mk mkisofs
  1261.  if {$all} {lappend mk -all-files}
  1262.  if {$joliet} {lappend mk -joliet}
  1263.  switch -exact $rock {
  1264.   none {}
  1265.   rat {lappend mk -r}
  1266.   lit {lappend mk -R}
  1267.  }
  1268.  if {$follow} {lappend mk -follow-links}
  1269.  if {$trans} {lappend mk -translation-table}
  1270.  if {$boot} {
  1271.   if {($bootimg == "") || ($bootcat == "")} {
  1272.    alert "You selected 'Bootable CD' but either the boot image or boot catalog entries are blank. This will not work."
  1273.    return
  1274.   }
  1275.   if {![file exists [file join $root $bootimg]]} {
  1276.    alert "[file join $root $bootimg] is not there. You can't make a bootable CD without a bootimage."
  1277.    return
  1278.   }
  1279.   if {[file exists [file join $root $bootcat]]} {
  1280.    if {![sure "[file join $root $bootcat] will be overwritten if you continue. Is this ok?"]} {return}
  1281.   }
  1282.   lappend mk -b $bootimg -c $bootcat
  1283.  } else {
  1284.   if {$bootimg != ""} {
  1285.    set ok [sure "You have stuff in the bootimage entry, but have not chosen the 'Bootable CD' option. Do you want a standard non-bootable cd?"]
  1286.    if {!$ok} {return}
  1287.   }
  1288.  }
  1289.  if {$vol != ""} {lappend mk -volid $vol}
  1290.  
  1291.  ## Here we need to (maybe) process the custom layout entries.
  1292.  lappend mk $root
  1293.  
  1294.  if {$custom(use)} {
  1295.   foreach dir $custom(from) graftpoint $custom(to) {
  1296.    if {$dir == ""} continue
  1297.    set isdir [file isdirectory $dir]
  1298.    if {$isdir} {set dir "$dir/"}
  1299.    lappend mk "$graftpoint/=$dir"
  1300.   }
  1301.  }
  1302.  
  1303.  ## Last gasp.
  1304.  # use a illegal filename as symbol for the pipe so it can be recognized later
  1305.  lappend mk "///PIPE///"
  1306.  return $mk
  1307.  }
  1308. proc open_bootfile {} {
  1309. set types {
  1310.     {{Disk Images}      {.img}        }
  1311.     {{All Files}        *             }
  1312. }
  1313. set boot_img [tk_getOpenFile -filetypes $types -initialdir ~/ -title {Choose Image}]
  1314. .boot.img.e delete 0 250
  1315. .boot.img.e insert 0 $boot_img
  1316. }
  1317. proc open_catfile {} {
  1318. set types {
  1319.     {{All Files}        *             }
  1320. }
  1321. set boot_cat [tk_getOpenFile -filetypes $types -initialdir ~/ -title {Choose File}]
  1322. .boot.cat.e delete 0 250
  1323. .boot.cat.e insert 0 $boot_cat
  1324. }
  1325. proc check_device dev {
  1326.  
  1327. if {[file writable $dev]} {
  1328.   return 1
  1329. }
  1330.  
  1331. # Now gotta test for numeric device specification
  1332.  
  1333. set len [string length $dev]
  1334. set field {0123456789,}
  1335.  
  1336. for {set i 0} {$i < $len} {incr i} {
  1337.   set try [string index $dev $i]
  1338.   if {![string match *$try* $field]} {return 0}
  1339. }
  1340.  
  1341. return 1
  1342. }
  1343.  
  1344.  
  1345.  
  1346.  
  1347. # This is CDR-Toaster
  1348.  
  1349. set speed 2
  1350. set joliet 1
  1351. set rock none
  1352. set dummy 1
  1353. set eject 1
  1354. set ds mkisofs
  1355. set apad 1
  1356. set dpad 0
  1357. set bootimg ""
  1358. set bootcat ""
  1359.  
  1360. set custom(from) {}
  1361. set custom(to) {}
  1362. set custom(use) 0
  1363.  
  1364. interface
  1365.  
  1366. .b.quit configure -command {destroy .}
  1367. .b.burn configure -command {toast}
  1368.  
  1369.  
  1370.