diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2006-03-16 13:04:28 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:57:30 -0500 |
commit | 3bb28c83e277bda9233de4cca71f367ce00be5c3 (patch) | |
tree | 6ee7d8b6c5d12ada27366452b99d250a10353039 /source4/script/installheader.pl | |
parent | 4f1c8daa36a7a0372c5fd9eab51f3c16ee81c49d (diff) | |
download | samba-3bb28c83e277bda9233de4cca71f367ce00be5c3.tar.gz samba-3bb28c83e277bda9233de4cca71f367ce00be5c3.tar.bz2 samba-3bb28c83e277bda9233de4cca71f367ce00be5c3.zip |
r14471: Convert installheader script to perl
(This used to be commit c6a478a1af38cad5622d3c3c53a7a99f9770b169)
Diffstat (limited to 'source4/script/installheader.pl')
-rwxr-xr-x | source4/script/installheader.pl | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/source4/script/installheader.pl b/source4/script/installheader.pl new file mode 100755 index 0000000000..1af05f3fea --- /dev/null +++ b/source4/script/installheader.pl @@ -0,0 +1,44 @@ +#!/usr/bin/perl +use strict; +use File::Basename; + +my $includedir = shift; + +sub install_header($$) +{ + my ($src,$dst) = @_; + + open(IN, "<$src"); + open(OUT, ">$dst"); + + while (<IN>) { + print OUT $_; + } + + close(OUT); + close(IN); +} + +foreach my $p (@ARGV) +{ + my $p2 = basename($p); + print "Installing $p as $includedir/$p2\n"; + + if ( -f "$includedir/$p2" ) { + unlink("$includedir/$p2.old"); + rename("$includedir/$p2", "$includedir/$p2.old"); + } + + install_header($p,"$includedir/$p2"); +} + +print <<EOF; +====================================================================== +The headers are installed. You may restore the old headers (if there +were any) using the command "make revert". You may uninstall the headers +using the command "make uninstallheader" or "make uninstall" to uninstall +binaries, man pages and shell scripts. +====================================================================== +EOF + +exit 0; |