1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#! /usr/bin/env tclsh
# Parse arguments
set opt_compression 1
if {[llength $argv] < 2} {
puts stderr "Usage: installvfs.tcl <kitfile> <vfsdir> \[<enable_compression>\]"
exit 1
}
set kitfile [lindex $argv 0]
set vfsdir [lindex $argv 1]
if {[lindex $argv 2] != ""} {
set opt_compression [lindex $argv 2]
}
# Determine what storage mechanism is being used
set fd [open Makefile.common r]
set data [read $fd]
close $fd
if {[string match "*KIT_STORAGE_ZIP*" $data]} {
|
<
|
|
|
>
|
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#! /usr/bin/env tclsh
# Parse arguments
if {[llength $argv] != 4} {
puts stderr "Usage: installvfs.tcl <kitfile> <vfsdir> <enable_compression> <outfile>"
exit 1
}
set kitfile [lindex $argv 0]
set vfsdir [lindex $argv 1]
set opt_compression [lindex $argv 2]
if {$opt_compression == ""} {
set opt_compression 1
}
set outfile [lindex $argv 3]
# Determine what storage mechanism is being used
set fd [open Makefile.common r]
set data [read $fd]
close $fd
if {[string match "*KIT_STORAGE_ZIP*" $data]} {
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
}
}
}
# Update the kit, based on what kind of kit this is
switch -- $tclKitStorage {
"mk4" {
if {[catch {
# Try as if a pre-existing Tclkit, or a tclsh
package require vfs::mk4
}]} {
# Try as if uninitialized Tclkit
catch {
load "" vfs
load "" Mk4tcl
source [file join $vfsdir lib/vfs/vfsUtils.tcl]
source [file join $vfsdir lib/vfs/vfslib.tcl]
source [file join $vfsdir lib/vfs/mk4vfs.tcl]
}
}
set mk4vfs::compress $opt_compression
set handle [vfs::mk4::Mount $kitfile /kit -nocommit]
recursive_copy $vfsdir /kit
vfs::unmount /kit
}
"zip" {
set kitfd [open $kitfile a+]
fconfigure $kitfd -translation binary
cd $vfsdir
if {$tcl_platform(platform) eq "windows"} {
set null NUL
} else {
set null /dev/null
|
>
>
|
>
>
|
|
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
}
}
}
# Update the kit, based on what kind of kit this is
switch -- $tclKitStorage {
"mk4" {
file copy $kitfile $outfile
if {[catch {
# Try as if a pre-existing Tclkit, or a tclsh
package require vfs::mk4
}]} {
# Try as if uninitialized Tclkit
catch {
load "" vfs
load "" Mk4tcl
source [file join $vfsdir lib/vfs/vfsUtils.tcl]
source [file join $vfsdir lib/vfs/vfslib.tcl]
source [file join $vfsdir lib/vfs/mk4vfs.tcl]
}
}
set mk4vfs::compress $opt_compression
set handle [vfs::mk4::Mount $outfile /kit -nocommit]
recursive_copy $vfsdir /kit
vfs::unmount /kit
}
"zip" {
file copy $kitfile $outfile
set kitfd [open $outfile a+]
fconfigure $kitfd -translation binary
cd $vfsdir
if {$tcl_platform(platform) eq "windows"} {
set null NUL
} else {
set null /dev/null
|
114
115
116
117
118
119
120
121
122
123
|
} err]} {
puts stderr "Error while updating executable: $err"
exit 1
}
}
"cvfs" {
# No-op
}
}
|
|
|
119
120
121
122
123
124
125
126
127
128
|
} err]} {
puts stderr "Error while updating executable: $err"
exit 1
}
}
"cvfs" {
file copy $kitfile $outfile
}
}
|