[Starkit] Re: Create metakit file from cgi-script
Jean-Claude Wippler
jcw at equi4.com
Tue Aug 30 13:48:20 CEST 2005
Hello Philip,
> I have a web site that I am dispensing starkits from. I am restricted
> in space so I don't have starpacks online. I am also prevented from
> writing to disk from the cgi script. Fortunately I can run tclkit as
> a cgi program.
>
> I can use a cgi script to append a starkit to a tclkit runtime
> provided that I have placed the necessary boot and lib files in the
> kit beforehand.
>
> Is it possible to create a kit file suitable for making a starpack
> from with tclkit that does not need any temporary disk space to run?
>
> I want to be able to just have the tcl files as online demos, and
> then dynamically wrap them into either a kit or starpack on request.
> This will save the space needed for binary extensions that at present
> need to be placed in every kit file.
Yes, that's definitely doable. The SDX "starsync" command does a lot
of similar trickery. The basic idea would be to make changes to a
kit (a copy of tclkit in the case of a starpack) which is mounted
read-only. Then, instead of committing the changes back to file, use
"mk::file save" to serialize the current state to any Tcl channel.
There is one issue to be aware of: read-only mounted starkits cannot
be written to by default. The following sets the mode to
"translucent", allowing writes but only by buffering them in memory
(the file is still r/o):
set db [vfs::mk4::Mount $path $path -readonly]
catch { vfs::attributes $path -state translucent }
This code snippet is from starsync.tcl inside SDX, btw.
To generate a starkit or starpack, you'd first send the fixed file
header (use "sdx mksplit" to get one for starkits and one for the exe
needed for starpacks), followed by the serialized MK data.
-jcw
PS. Please consider posting questions like these to the starkit
mailing list - I suspect others are interested in these issues as
well, and perhaps even already have done such things. See http://
www.equi4.com/mailman/listinfo/starkit - I've taken the liberty to CC
this reply to the list.
More information about the Starkit
mailing list