@@ -1,20 +1,21 @@ #! /usr/bin/env tclsh # Parse arguments -set opt_compression 1 -if {[llength $argv] < 2} { - puts stderr "Usage: installvfs.tcl \[\]" +if {[llength $argv] != 4} { + puts stderr "Usage: installvfs.tcl " exit 1 } set kitfile [lindex $argv 0] set vfsdir [lindex $argv 1] -if {[lindex $argv 2] != ""} { - set opt_compression [lindex $argv 2] +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 @@ -69,10 +70,12 @@ } # 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 @@ -85,18 +88,20 @@ source [file join $vfsdir lib/vfs/mk4vfs.tcl] } } set mk4vfs::compress $opt_compression - set handle [vfs::mk4::Mount $kitfile /kit -nocommit] + set handle [vfs::mk4::Mount $outfile /kit -nocommit] recursive_copy $vfsdir /kit vfs::unmount /kit } "zip" { - set kitfd [open $kitfile a+] + file copy $kitfile $outfile + + set kitfd [open $outfile a+] fconfigure $kitfd -translation binary cd $vfsdir if {$tcl_platform(platform) eq "windows"} { set null NUL @@ -116,8 +121,8 @@ exit 1 } } "cvfs" { - # No-op + file copy $kitfile $outfile } }