[25] | 1 | #!/bin/sh |
---|
| 2 | #\ |
---|
| 3 | exec tclsh "$0" ${1+"$@"} |
---|
| 4 | |
---|
| 5 | #---------------------------------------------------------------------- |
---|
| 6 | # |
---|
| 7 | # installData.tcl -- |
---|
| 8 | # |
---|
| 9 | # This file installs a hierarchy of data found in the directory |
---|
| 10 | # specified by its first argument into the directory specified |
---|
| 11 | # by its second. |
---|
| 12 | # |
---|
| 13 | #---------------------------------------------------------------------- |
---|
| 14 | # |
---|
| 15 | # Copyright (c) 2004 by Kevin B. Kenny. All rights reserved. |
---|
| 16 | # See the file "license.terms" for information on usage and redistribution |
---|
| 17 | # of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 18 | # |
---|
| 19 | # RCS: @(#) $Id: installData.tcl,v 1.1 2004/08/18 19:59:09 kennykb Exp $ |
---|
| 20 | # |
---|
| 21 | #---------------------------------------------------------------------- |
---|
| 22 | |
---|
| 23 | proc copyDir { d1 d2 } { |
---|
| 24 | |
---|
| 25 | puts [format {%*sCreating %s} [expr { 4 * [info level] }] {} \ |
---|
| 26 | [file tail $d2]] |
---|
| 27 | |
---|
| 28 | file delete -force -- $d2 |
---|
| 29 | file mkdir $d2 |
---|
| 30 | |
---|
| 31 | foreach ftail [glob -directory $d1 -nocomplain -tails *] { |
---|
| 32 | set f [file join $d1 $ftail] |
---|
| 33 | if { [file isdirectory $f] && [string compare CVS $ftail] } { |
---|
| 34 | copyDir $f [file join $d2 $ftail] |
---|
| 35 | } elseif { [file isfile $f] } { |
---|
| 36 | file copy -force $f [file join $d2 $ftail] |
---|
| 37 | if { $::tcl_platform(platform) eq {unix} } { |
---|
| 38 | file attributes [file join $d2 $ftail] -permissions 0644 |
---|
| 39 | } else { |
---|
| 40 | file attributes [file join $d2 $ftail] -readonly 1 |
---|
| 41 | } |
---|
| 42 | } |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | if { $::tcl_platform(platform) eq {unix} } { |
---|
| 46 | file attributes $d2 -permissions 0755 |
---|
| 47 | } else { |
---|
| 48 | file attributes $d2 -readonly 1 |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | copyDir [lindex $argv 0] [lindex $argv 1] |
---|