$OpenBSD: patch-installer_tcl,v 1.2 2011/01/05 16:27:24 stu Exp $
--- installer.tcl.orig	Mon Dec  7 09:56:53 2009
+++ installer.tcl	Mon Oct  4 23:59:02 2010
@@ -79,21 +79,29 @@ if {![package vsatisfies [package provide Tcl] 8.0]} {
     puts  $index "unset maindir"
     puts  $index ""
     close $index
+    file attributes [file join $outdir pkgIndex.tcl] -owner root -group bin -permissions 0444
     return
 }
 
 proc xcopyfile {src dest} {
     # dest can be dir or file
     run file copy -force $src $dest
+    if {[file isdirectory $dest]} {
+	set dest [file join $dest [file tail $src]]
+    }
+    file attributes $dest -owner root -group bin -permissions 0444
     return
 }
 
 proc xcopy {src dest recurse {pattern *}} {
     run file mkdir $dest
 
+    file attributes $dest -owner root -group bin -permissions 0755
     if {[string equal $pattern *] || !$recurse} {
 	foreach file [glob [file join $src $pattern]] {
+	    if {[file extension $file] eq ".orig"} { continue }
 	    set base [file tail $file]
+	    if {$base eq "ChangeLog"} { continue }
 	    set sub  [file join $dest $base]
 
 	    if {0 == [string compare CVS $base]} {continue}
@@ -144,6 +152,7 @@ proc write_out {f text} {
     catch {file delete -force $f}
     puts -nonewline [set of [open $f w]] $text
     close $of
+    file attributes $f -owner root -group bin -permissions 0444
 }
 
 
@@ -245,7 +254,6 @@ proc doinstall {} {
     }
     if {$config(pkg)}       {
 	xinstall   pkg $config(pkg,path)
-	gen_main_index $config(pkg,path) $package_name $package_version
 	if {$config(doc,nroff)} {
 	    xinstall doc nroff n    $config(doc,nroff,path)
 	}
