Browse files

Keep file permissions

This patch forces the system to keep the same permissions on the
files being tokenized.  This is useful for files in bin type
directories that need to be campified to point to the proper
lib directories.
  • Loading branch information...
1 parent 89686fe commit 964c608f5a571dd051a1b77e3bbc34e989480a51 @rmtemplet committed Oct 3, 2011
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/Camp/Master.pm
View
2 lib/Camp/Master.pm
@@ -2023,6 +2023,7 @@ sub install_templates {
for my $file (@edits) {
my $source_path = File::Spec->catfile($template_path, $file);
print "Interpolating tokenized template file '$source_path'...";
+ my $mode = (stat($source_path))[2];
open(my $INFILE, '<', $source_path) or die "Failed to open template file '$source_path': $!\n";
my $template = <$INFILE>;
$template = substitute_hash_tokens(
@@ -2037,6 +2038,7 @@ sub install_templates {
open(my $OUTFILE, '>', $target_path) or die "Failed writing configuration file '$target_path': $!\n";
print $OUTFILE $template;
close $OUTFILE or die "Error closing $target_path: $!\n";
+ chmod($mode, $target_path);
}
type_message('install_templates');
return;

0 comments on commit 964c608

Please sign in to comment.