summaryrefslogtreecommitdiffstats
path: root/perl-install/install_any.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/install_any.pm')
-rw-r--r--perl-install/install_any.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 654e703b3..633e9d6c6 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -422,3 +422,23 @@ sub fsck_option() {
my $y = $::o->{security} < 3 && $::beginner && "-y ";
substInFile { s/^(\s*fsckoptions=)(-y )?/$1$y/ } "$::o->{prefix}/etc/rc.d/rc.sysinit";
}
+
+sub translate_file($$%) {
+ my ($inputfile, $outputfile, %toreplace) = @_;
+ local *OUT; local *IN;
+
+ open IN , $inputfile or die "Can't open $inputfile $!";
+ if ($::testing) {
+ *OUT = *STDOUT;
+ } else {
+ open OUT, ">$outputfile" or die "Can't open $outputfile $!";
+ }
+
+ while (<IN>) {
+ if (/@@@(.*)@@@/) {
+ my $r = $toreplace{$1};
+ s/@@@(.*)@@@/$r/g;
+ }
+ print OUT;
+ }
+}