Tcl Source Code

Check-in [6011ff29c5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix: clarified some features in zipfs, also making them more explicitly documented
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | documentation-cleanup-for-transition
Files: files | file ages | folders
SHA3-256: 6011ff29c583afd0e0d5d58abab8cdf1b81ad7d73ee6a41be68f6f2219cf1da7
User & Date: Torsten 2024-07-22 22:11:03.462
Context
2024-09-02
11:00
cherrypicked typos, errors and clarifications from the documentation-cleanup-for-transition branch (... check-in: 2496f1377a user: Torsten tags: trunk, main
2024-07-22
22:15
Fix: typo in tclsh(1) check-in: 5188897949 user: Torsten tags: documentation-cleanup-for-transition
22:11
Fix: clarified some features in zipfs, also making them more explicitly documented check-in: 6011ff29c5 user: Torsten tags: documentation-cleanup-for-transition
21:04
Fix: in zipfs, add 'w' parameter to [file open] in the last code example as it would otherwise open ... check-in: 7a3dd7e0f9 user: Torsten tags: documentation-cleanup-for-transition
Changes
Unified Diff Ignore Whitespace Patch
Changes to doc/zipfs.n.
179
180
181
182
183
184
185
186

187
188
189
190
191

192
193
194
195
196
197
198
.RE
.\" METHOD: mkimg
.TP
\fBzipfs mkimg\fI outfile indir\fR ?\fIstrip\fR? ?\fIpassword\fR? ?\fIinfile\fR?
.
Creates an image (potentially a new executable file) similar to \fBzipfs
mkzip\fR; see that command for a description of most parameters to this
command, as they behave identically here.

.RS
.PP
If the \fIinfile\fR parameter is specified, this file is prepended in front of
the ZIP archive, otherwise the file returned by \fBinfo nameofexecutable\fR
(i.e., the executable file of the running process) is used. If the

\fIpassword\fR parameter is not empty, an obfuscated version of that password
(see \fBzipfs mkkey\fR) is placed between the image and ZIP chunks of the
output file and the contents of the ZIP chunk are protected with that
password.
If the starting image has a ZIP archive already attached to it, it is removed
from the copy in \fIoutfile\fR before the new ZIP archive is added.
.PP







|
>




|
>







179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
.RE
.\" METHOD: mkimg
.TP
\fBzipfs mkimg\fI outfile indir\fR ?\fIstrip\fR? ?\fIpassword\fR? ?\fIinfile\fR?
.
Creates an image (potentially a new executable file) similar to \fBzipfs
mkzip\fR; see that command for a description of most parameters to this
command, as they behave identically here. If \fIoutfile\fR exists, it will
be silently overwritten.
.RS
.PP
If the \fIinfile\fR parameter is specified, this file is prepended in front of
the ZIP archive, otherwise the file returned by \fBinfo nameofexecutable\fR
(i.e., the executable file of the running process,
typically \fBwish\fR or \fBtclsh\fR) is used. If the
\fIpassword\fR parameter is not empty, an obfuscated version of that password
(see \fBzipfs mkkey\fR) is placed between the image and ZIP chunks of the
output file and the contents of the ZIP chunk are protected with that
password.
If the starting image has a ZIP archive already attached to it, it is removed
from the copy in \fIoutfile\fR before the new ZIP archive is added.
.PP
281
282
283
284
285
286
287




288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306



307
308
309
310
311
312
313
314
315
316
317
318
# Create with password
\fBzipfs mkzip\fR $targetZip $sourceDir $sourceDir $password

# Mount with password
\fBzipfs mount\fR $zip $base $password
.CE
.PP




When creating an executable image with a password, the password is placed
within the executable in a shrouded form so that the application can read
files inside the embedded ZIP archive yet casual inspection cannot read it.
.PP
.CS
set appDir [file normalize myApp]
set img "myApp.bin"
set password "hunter2"

# Create some simple content to define a basic application
file mkdir $appDir
set f [open $appDir/main.tcl w]
puts $f {
    puts "Hi. This is [info script]"
}
close $f

# Create the executable
\fBzipfs mkimg\fR $img $appDir $appDir $password




# Launch the executable, printing its output to stdout
exec $img >@stdout
#    prints: \fIHi. This is //zipfs:/app/main.tcl\fR
.CE
.SH "SEE ALSO"
tclsh(1), file(n), zipfs(3), zlib(n)
.SH "KEYWORDS"
compress, filesystem, zip
'\" Local Variables:
'\" mode: nroff
'\" End:







>
>
>
>

















|

>
>
>












283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
# Create with password
\fBzipfs mkzip\fR $targetZip $sourceDir $sourceDir $password

# Mount with password
\fBzipfs mount\fR $zip $base $password
.CE
.PP
The following example creates an executable application by appending a ZIP archive
to the tclsh file it was called from and storing the resulting executable in
the file
.QW myApp.bin .
When creating an executable image with a password, the password is placed
within the executable in a shrouded form so that the application can read
files inside the embedded ZIP archive yet casual inspection cannot read it.
.PP
.CS
set appDir [file normalize myApp]
set img "myApp.bin"
set password "hunter2"

# Create some simple content to define a basic application
file mkdir $appDir
set f [open $appDir/main.tcl w]
puts $f {
    puts "Hi. This is [info script]"
}
close $f

# Create the executable application
\fBzipfs mkimg\fR $img $appDir $appDir $password

# remove the now obsolete temporary appDir folder
file delete -force $appDir

# Launch the executable, printing its output to stdout
exec $img >@stdout
#    prints: \fIHi. This is //zipfs:/app/main.tcl\fR
.CE
.SH "SEE ALSO"
tclsh(1), file(n), zipfs(3), zlib(n)
.SH "KEYWORDS"
compress, filesystem, zip
'\" Local Variables:
'\" mode: nroff
'\" End: