svn commit: samba r14471 - in branches/SAMBA_4_0/source: . script

jelmer at samba.org jelmer at samba.org
Thu Mar 16 13:04:29 GMT 2006


Author: jelmer
Date: 2006-03-16 13:04:28 +0000 (Thu, 16 Mar 2006)
New Revision: 14471

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=14471

Log:
Convert installheader script to perl

Added:
   branches/SAMBA_4_0/source/script/installheader.pl
Removed:
   branches/SAMBA_4_0/source/script/installheader.sh
Modified:
   branches/SAMBA_4_0/source/main.mk


Changeset:
Modified: branches/SAMBA_4_0/source/main.mk
===================================================================
--- branches/SAMBA_4_0/source/main.mk	2006-03-16 12:43:28 UTC (rev 14470)
+++ branches/SAMBA_4_0/source/main.mk	2006-03-16 13:04:28 UTC (rev 14471)
@@ -128,7 +128,7 @@
 	@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(LIBDIR) $(STATIC_LIBS)
 
 installheader: headers installdirs
-	@$(SHELL) $(srcdir)/script/installheader.sh $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
+	@$(PERL) $(srcdir)/script/installheader.pl $(DESTDIR)$(INCLUDEDIR) $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
 
 installdat: installdirs
 	@$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(DATADIR) $(srcdir)

Copied: branches/SAMBA_4_0/source/script/installheader.pl (from rev 14467, branches/SAMBA_4_0/source/script/installheader.sh)
===================================================================
--- branches/SAMBA_4_0/source/script/installheader.sh	2006-03-16 11:04:21 UTC (rev 14467)
+++ branches/SAMBA_4_0/source/script/installheader.pl	2006-03-16 13:04:28 UTC (rev 14471)
@@ -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;

Deleted: branches/SAMBA_4_0/source/script/installheader.sh
===================================================================
--- branches/SAMBA_4_0/source/script/installheader.sh	2006-03-16 12:43:28 UTC (rev 14470)
+++ branches/SAMBA_4_0/source/script/installheader.sh	2006-03-16 13:04:28 UTC (rev 14471)
@@ -1,26 +0,0 @@
-#!/bin/sh
-
-INCLUDEDIR=$1
-shift
-
-for p in $*; do
- p2=`basename $p`
- echo Installing $p as $INCLUDEDIR/$p2
- if [ -f $INCLUDEDIR/$p2 ]; then
-   rm -f $INCLUDEDIR/$p2.old
-   mv $INCLUDEDIR/$p2 $INCLUDEDIR/$p2.old
- fi
- cp $p $INCLUDEDIR/
-
-done
-
-cat << 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



More information about the samba-cvs mailing list