diff options
author | Moritz Lenz <moritz@faui2k3.org> | 2012-08-20 22:33:40 +0200 |
---|---|---|
committer | Moritz Lenz <moritz@faui2k3.org> | 2012-08-20 22:55:45 +0200 |
commit | 089584d3577b72ed3fb405a32f35469ca7b939ab (patch) | |
tree | 8ec9f7275da179be636d3ad8334724c2ce24f807 /skel/tools/build/bin-install.pl | |
parent | c4afc586ed35a5da9e7b0d2966a7972db0c47f2e (diff) |
adapt shebang line on installing
Diffstat (limited to 'skel/tools/build/bin-install.pl')
-rw-r--r-- | skel/tools/build/bin-install.pl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/skel/tools/build/bin-install.pl b/skel/tools/build/bin-install.pl new file mode 100644 index 0000000..1c71cea --- /dev/null +++ b/skel/tools/build/bin-install.pl @@ -0,0 +1,28 @@ +#! perl + +use strict; +use warnings; +use File::Spec; + +my ($p6bin, $dest, @files) = @ARGV; +die "Usage: $0 <perl6_binary> <destination_path> <source_files>" + unless $p6bin && $dest; + +for my $filename (@files) { + open my $IN, '<', $filename + or die "Cannot read file '$filename' for installing it: $!"; + my $basename = (File::Spec->splitpath($filename))[2]; + open my $OUT, '>', "$dest/$basename" + or die "Cannot write file '$dest/$basename' for installing it: $!"; + while (<$IN>) { + if ($. == 1 && /^#!/) { + print { $OUT } "#!$p6bin\n"; + } + else { + print { $OUT } $_; + } + } + close $OUT or die "Error while closing file '$dest/$basename': $!"; + close $IN; + chmod 0755, "$dest/$basename"; +} |