Add some tests
[maxima.git] / archive / deliver / unpack.tcl
blob3d23f3b7b9e579c91d7ed735966b525ed155418d
2 global pkgDefDir
3 global here done
4 set here $pkgDefDir(maxima)
5 # replace the backslashess..
6 regsub -all "\\\\" $here / here
8 cd $here
10 source ./deliver/zipinfo.tcl
13 proc setPercent { n } {
14 upstat $n
17 proc joe { f zipfile} {
18 global installResult done unzipped
19 set tem [string trim [read $f] \n]
20 # puts tem=$tem
21 if { "$tem" == "" && [eof $f] } {
22 if { [file exists src/max.ico] } {
23 set installResult "Installation Completed Successfully"
24 set done 1
26 } else {
27 set installResult "Installation Failed"
28 set done -1
31 close $f
32 update
33 return
35 append unzipped($zipfile) \n$tem
37 set tem [split [string trim $tem \n] \n]
38 global zipinfo
39 setPercent [expr [llength $unzipped($zipfile)] *100.0 / [lindex $zipinfo($zipfile) 1]]
40 set installResult [lindex $tem end]
41 update
44 global zipfile
46 if { "[array names zipinfo]" != "" } {
47 pack .progress.frame0
48 .progress.frame0.frame3.label4 config -text {Unzipping: }
49 .progress.frame0.frame3.label5 config -textvariable zipfile -text {}
50 .progress.frame0.frame3.label0 config -textvariable {} -text {}
55 foreach v [array names zipinfo] {
56 setPercent 0
57 set zipfile $v
58 update
59 set f [open "| unzip -o $zipfile" r]
60 fconfigure $f -blocking 0
61 set done 0
62 fileevent $f readable "joe $f $zipfile"
63 vwait done
67 proc backslash { s } {
68 regsub -all "/" $s "\\" s
69 return $s
72 # wait to do these till the icons and stuff are there..
73 after 200 installShortcuts
75 proc installShortcuts { } {
76 global done here
78 if { [tk_dialog .jim ask {Add xmaxima to the Start Menu under Programs} {} yes no yes ] } {
79 set programDir [file join [::freewrap::getSpecialDir PROGRAMS]]
80 catch { file delete [file join $programDir Maxima.lnk] }
81 ::freewrap::shortcut [file join $programDir Maxima.lnk] \
82 -objectPath [backslash [file join $here src xmaxima.exe]] \
83 -workingDirectory [backslash $here] \
84 -icon [backslash [file join $here src max.ico]] 0
86 ::freewrap::shortcut [file join $here Maxima.lnk] \
87 -objectPath [backslash [file join $here src xmaxima.exe]] \
88 -workingDirectory [backslash $here] \
89 -icon [backslash [file join $here src max.ico]] 0
90 file delete maxima.zip
91 file delete unpack.tcl
92 set f [open init.lsp w]
93 puts $f "(si::setenv \"PATH\" (concatenate 'string (substitute #\\\\ #\\/ \"$here/gcc/bin;\") (si::getenv \"PATH\")))"
94 close $f
100 # file delete unzip.exe