diff options
| author | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:48 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2013-04-06 13:14:48 +0200 |
| commit | bf5fc4cc4a15e8e57db58c2e065e0f5adbd8e800 (patch) | |
| tree | 855a98aec6d09361074c9725e08063553044ecfb /scripts/makeyhttpd.pl | |
| parent | d9c4a95345bd758e45196b29368bd2ff0f2790e3 (diff) | |
tagging ychat-0.7.9.3ychat-0.7.9.3
Diffstat (limited to 'scripts/makeyhttpd.pl')
| -rw-r--r-- | scripts/makeyhttpd.pl | 97 |
1 files changed, 81 insertions, 16 deletions
diff --git a/scripts/makeyhttpd.pl b/scripts/makeyhttpd.pl index 2805360..7dd0345 100644 --- a/scripts/makeyhttpd.pl +++ b/scripts/makeyhttpd.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# The yChat & yhttpd Project (2004) +# The yChat & yhttpd Project (2004, 2005) # # This scripts modifies the yChat sources to yhttpd sources. @@ -8,18 +8,19 @@ use strict; use scripts::modules::file; my @delete = ( - 'ChangeLog', + 'CHANGES', 'g++.version', 'TODO', 'NEWS', 'docs', 'src/chat', + 'src/memb', 'src/data', 'src/irc', 'src/contrib/crypt', + 'src/modl.h', + 'src/modl.cpp', 'src/mods', - 'src/mods/commands', - 'src/mods/irc', 'obj', 'mods', 'html', @@ -39,6 +40,7 @@ my %substituate = ( 'yChat' => 'yhttpd', 'YCHAT' => 'YHTTPD', 'CHAT' => 'HTTPD', + 'yhttpd.org' => 'yChat.org', '//>>' => '' ); @@ -75,7 +77,7 @@ foreach (@delete) { system("rm -Rf $_"); } -print "Deleting CVS directories\n"; +print "\nDeleting CVS directories\n"; system("find . -name CVS | xargs rm -Rf"); print "Creating new dirs\n->"; @@ -84,50 +86,113 @@ foreach (@createdir) { system("mkdir $_"); } -print "Renaming config file\n"; +print "\nRenaming config file\n"; system("mv etc/ychat.conf etc/yhttpd.conf"); print "Moving html templates\n"; system("mv demo.html html/index.html"); system("mv test.cgi notfound.html style.css html"); -print "Removing marked lines of code\n ->"; +print "Editing etc/yhttpd.conf\n"; +&edit_yhttpd_conf(); +print "Removing marked lines of code\n->"; &remove_marked_lines('.'); +print "\nEdit version numbers\n->"; +&edit_version_numbers('yhttpd/src/msgs.h','yhttpd/README'); sub remove_marked_lines { my $dir = shift; chdir($dir); - foreach (&dopen(".")) { + + for (&dopen(".")) + { next if /^\.+$/; print " $_"; - if ( -f $_ ) { + + if ( -f $_ ) + { my @newfile; my $flag = 0; - foreach my $line (fopen($_)) { + + for my $line (fopen($_)) + { $flag = 1 if $line =~ /\/\/<<\*/; if ($flag == 0 && $line !~ /\/\/<</) { - foreach ( @deletelines ) { - if ($line =~ /$_/) { + for ( @deletelines ) + { + if ($line =~ /$_/) + { $flag = 3; last; } } - if ($flag != 3 ) { + + if ($flag != 3 ) + { map { $line =~ s/$_/$substituate{$_}/eg } keys %substituate; push @newfile, $line; - } else { + } + + else + { $flag = 0; } } $flag = 0 if $line =~ /\/\/\*>>/; } + &fwrite($_, @newfile); - } elsif ( -d $_ ) { + } + + elsif ( -d $_ ) + { + # Recursive &remove_marked_lines($_); } } + chdir('..'); } -print "\n"; +sub edit_yhttpd_conf +{ + my @old = fopen("etc/yhttpd.conf"); + my @new = @old[0..1]; + + my $flag = 0; + for (@old) + { + if ($flag == 0) + { + if (/<category name="httpd">/) + { + $flag = 1; + push @new, $_; + } + } + + else + { + push @new, $_; + } + } + + fwrite("etc/yhttpd.conf", @new); +} +sub edit_version_numbers +{ + for (@_) + { + print " $_"; + my @file = fopen $_; + for (@file) + { + s/([0-9]+\.[0-9]+)\.[0-9]+(-*)/$1$2/g for @file; + s/RELEASE/DEVEL/g; + } + fwrite($_,@file); + } +} + +print "\n"; |
