1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
+
+
+
+
+
+
+
+
+
|
#! /usr/bin/env tclsh
# This file has no license. It is in the public domain.
# -- Roy Keene <tcl@rkeene.org> [20081025T1400Q]
namespace eval ::teapotclient {}
package require Tcl
package require md5
package require http
package require fileutil
set ::teapotclient::have_vfszip 0
catch {
package require vfs::zip
set ::teapotclient::have_vfszip 1
}
namespace eval ::teapotclient {}
namespace eval ::teapotclient {
proc __get_tmpdir {} {
foreach checkenv [list TMPDIR TEMP TMP TEMPDIR] {
if {[info exists ::env($checkenv)]} {
return $::env($checkenv)
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
|
file mkdir $::env(HOME)
}
return $::env(HOME)
}
proc __unzip {dir file} {
file mkdir $dir
if {$::teapotclient::have_vfszip} {
set mntfd [vfs::zip::Mount $file $file]
foreach filetail [glob -nocomplain -tails -directory $file *] {
set srcfile [file join $file $filetail]
set destdir [file dirname [file join $dir $filetail]]
file copy -force -- $srcfile $destdir
}
vfs::zip::Unmount $mntfd $file
} else {
exec unzip -d $dir -n -qq $urlcachefile
exec unzip -d $dir -n -qq $urlcachefile
}
}
set pkgcachedir [file join [__get_homedir] ".teapot-client" "cachedir"]
# Conversions from Teapot-style names to local ones
set osTeapotToLocal(tcl) *
set osTeapotToLocal(linux-*) linux
|