<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">#!/usr/bin/perl -w

use File::Basename;
use strict;

# bitte die Dateinamen anpassen

my %VARS_ = (
	"SVN_archive" 	=&gt; "subversion-1.1.1.tar.bz2",
	"DB_archive"	=&gt; "db-4.2.52.NC.tar.gz",
	"DB_patches"	=&gt; ["db_patch.4.2.52.1","db_patch.4.2.52.2"],
	"APACHE_archive"=&gt; "httpd-2.0.52.tar.bz2",
	"LOG_FILE"	=&gt; "svn_install.log"
);
# wo befindet sich denn �berhaupt das BASE_DIR ?
$VARS_{BASE_DIR} = $ENV{PWD};
# vars �berpr�fen
print "\n Checking paths ...\n";
foreach my $key ( sort keys %VARS_ ){
	#print $key,"\t",$VARS_{$key},"\n";
	if (-e $VARS_{$key}){
		print $key,"\t",$VARS_{$key},"\t ok \n";
	}
	# liste der patches
	elsif ($VARS_{$key} =~ /^ARRAY/){
		foreach my $patch ( @{$VARS_{$key}}){
			if(-e $patch){
				print $key,"\t",$patch,"\t ok \n";
			}
			else {	die $key,"\t",$patch,"\t fail\n";}
		}
	}
	else{
		die $key,"\t",$VARS_{$key},"\t fail\n";
	}
}
print "\n";
# alles mitloggen
$VARS_{LOG} = $VARS_{BASE_DIR}."/".$VARS_{LOG_FILE};
open(LOG,"&gt;&gt;".$VARS_{LOG})
	|| eval { print "Fehler: ",$^E; exit;}; #logfile �ffnen
&amp;logg("starting ...");


# *********************
# SUBVERSION entpacken
	&amp;logg("SVN entpacke ".$VARS_{SVN_archive});
	($VARS_{SVN_DIR} = $VARS_{SVN_archive}) =~ s/\.tar\.(bz2|gz)$//i;
	unless(-e $VARS_{SVN_DIR}){
		# bz2 oder gz
		if 	( $VARS_{SVN_archive} =~ /\.tar\.bz2$/i)	{ `tar -xjf $VARS_{SVN_archive}`;}
		elsif	( $VARS_{SVN_archive} =~ /\.tar\.gz$/i)		{ `tar -xzf $VARS_{SVN_archive}`;}
		else	{ die "\n Filetyp unknown $VARS_{SVN_archive}\n";}
		print " fertig\n";
	}
#sub t{

# *********************
# ./autogen.sh im Subversion-dir ausf�hren
	chdir( $VARS_{SVN_DIR} );
	`rm -r apr-util/xml/expat/autom4te.cache`;
	&amp;logg("SVN ./autogen.sh im svn-dir");
	`./autogen.sh`;
	chdir("..");

# *********************
# DB entpacken
	&amp;logg("DB entpacke ".$VARS_{DB_archive});
	($VARS_{DB_DIR} = $VARS_{DB_archive}) =~ s/\.tar\.(bz2|gz)$//i;
	unless(-e $VARS_{DB_DIR}){
		# bz2 oder gz
		if 	( $VARS_{DB_archive} =~ /\.tar\.bz2$/i)	{ `tar -xjf $VARS_{DB_archive}`;}
		elsif	( $VARS_{DB_archive} =~ /\.tar\.gz$/i)		{ `tar -xzf $VARS_{DB_archive}`;}
		else	{ die "\n Filetyp unknown $VARS_{DB_archive}\n";}
		print " fertig\n";
	}

# *********************
# DB patchen
	&amp;logg("DB patching DB ...");
	chdir($VARS_{DB_DIR});
	foreach my $patch_ ( @{$VARS_{DB_patches}}){
		`patch -p0 &lt; ../$patch_ &gt;&gt; $VARS_{LOG}`;
	}
	chdir("..");

# *********************
# DB konfigurieren, make , make install, bekannt machen
	&amp;logg("DB ./build_unix ... ");
	chdir($VARS_{DB_DIR}."/build_unix");
	`../dist/configure &gt;&gt; $VARS_{LOG}`;
	&amp;logg("DB make ... ");
	`make &gt;&gt; $VARS_{LOG}`;
	&amp;logg("DB make install ... ");
	`make install &gt;&gt; $VARS_{LOG}`;
	&amp;logg("DB make clean ... ");
	`make clean &gt;&gt; $VARS_{LOG}`;
	$VARS_{DB_libs} = "/usr/local/BerkeleyDB.4.2/lib";
		my $_cmd_fgrep = `fgrep $VARS_{DB_libs} /etc/ld.so.conf`;
		chomp($_cmd_fgrep);
		unless( $_cmd_fgrep eq $VARS_{DB_libs}){
			exec("echo $VARS_{DB_libs} &gt;&gt; /etc/ld.so.conf");
			exec("ldconfig");
		}
	chdir("../..");

## *********************
## APACHE entpacken, konfigurieren, make, make install, make clean
	&amp;logg("APACHE entpacke ".$VARS_{APACHE_archive});
	($VARS_{APACHE_DIR} = $VARS_{APACHE_archive}) =~ s/\.tar\.(bz2|gz)$//i;
	unless(-e $VARS_{APACHE_DIR}){
		# bz2 oder gz
		if 	( $VARS_{APACHE_archive} =~ /\.tar\.bz2$/i)		{ `tar -xjf $VARS_{APACHE_archive}`;}
		elsif	( $VARS_{APACHE_archive} =~ /\.tar\.gz$/i)		{ `tar -xzf $VARS_{APACHE_archive}`;}
		else	{ die "\n Filetyp unknown $VARS_{APACHE_archive}\n";}
		print " fertig\n";
	}
	chdir($VARS_{APACHE_DIR});
	&amp;logg("APACHE ./buildconf ... ");
	`./buildconf &gt;&gt; $VARS_{LOG}`;	# produziert Fehler, muss deswegen ohne Fehlerabfang ausgef�hrt werden
	&amp;logg("APACHE ./configure ... ");
	`./configure --enable-dav=shared --with-gdbm=no --enable-deflate=shared --enable-so --with-berkeley-db=/usr/local/BerkeleyDB.4.2 --with-dbm=db4&gt;&gt; $VARS_{LOG}`;
	&amp;logg("APACHE make ... ");
	`make &gt;&gt; $VARS_{LOG}`;
	&amp;logg("APACHE make install ... ");
	`make install &gt;&gt; $VARS_{LOG}`;
	&amp;logg("APACHE make clean ... ");
	`make clean &gt;&gt; $VARS_{LOG}`;
	chdir("..");
#}
## *********************
## SUBVERSION konfigurieren, make, make install, make clean
	chdir($VARS_{SVN_DIR});
	&amp;logg("SVN ./configure");
	`./configure --with-berkeley-db=/usr/local/BerkeleyDB.4.2 --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apache2 --with-apr-util=/usr/local/apache2`;
	&amp;logg("SVN loesche /usr/local/lib/libsvn*");
	`rm -f /usr/local/lib/libsvn*`;
	&amp;logg("SVN loesche /usr/local/lib/libneon*");
	`rm -f /usr/local/lib/libneon*`;
	&amp;logg("SVN make");
	`make &gt;&gt; $VARS_{LOG}`;
	&amp;logg("SVN make install");
	`make install &gt;&gt; $VARS_{LOG}`;
	&amp;logg("SVN make clean");
	`make clean &gt;&gt; $VARS_{LOG}`;
	&amp;logg("SVN cp tools/xslt/* /usr/local/apache2/htdocs");
	`cp tools/xslt/* /usr/local/apache2/htdocs`;
	&amp;logg("SVN Gruppe svn anlegen");
	`groupadd -r svn`;
	&amp;logg("SVN Nutzer anlegen");
	`useradd -r -g svn svn`;
	&amp;logg("SVN Benutzerpasswort setzen");
	`passwd svn`;

foreach my $dir ("SVN_DIR","APACHE_DIR","DB_DIR"){
	&amp;logg("loesche ".$VARS_{$dir});
	`rm -r $VARS_{$dir} &gt;&gt; $VARS_{LOG}`;
}

print "\n"x2,"so nun bitte ab Punkt 40 selber weitermachen","\n"x2;

&amp;logg("... ending.");
close(LOG);	# Logfile schlie�en
sub ex{
	`$_[0] &gt;&gt; $VARS_{LOG}` || die "Fehler: $_[0] $^E\n";
}

# mitloggen
sub logg{
	my $date = `date`;		# datum
	chomp($date);			# ohne zus�tzlichen Absatz
	print LOG "\n",$date,"\t",$_[0],"\n";# schreiben
	print $_[0],"\n";
}
</pre></body></html>