summaryrefslogtreecommitdiff
path: root/source4/script/installheader.pl
blob: 1af05f3fea65d99c1bf174f0626116b6c16ae006 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;