OSDN Git Service

Add MS7619SE
[uclinux-h8/uClinux-dist.git] / user / snort / verstuff.pl
1 #!/usr/bin/perl -w
2 # $Id$
3 # Author: Chris Green <cmg@sourcefire.com>
4 # Purpose: make sure snort versions stay in sync
5 # Created: Tue Jul 22 17:21:42 EDT 2003
6
7 use strict;
8
9 my $version = "Unknown!";
10
11 if($#ARGV < 0)
12 {
13     die "bad args found!\n";
14 }
15
16 my $prefix = $ARGV[0];
17
18 open(CONFIGURE,"$prefix/configure.in") or die "Can't open configure.in!\n";
19
20 while(<CONFIGURE>)
21 {
22     if($_ =~ m/^AM_INIT_AUTOMAKE\(snort,/)
23     {
24         chomp;
25         $version = $_;
26         $version =~ s/^AM_INIT_AUTOMAKE\(snort,([^\)]+)\)/$1/;
27         last;
28     }
29 }
30 close(CONFIGURE);
31
32
33 # print "version is $version!\n";
34
35
36 open(WIN32CONFIG, "$prefix/src/win32/WIN32-Includes/config.h");
37 open(WIN32CONFIGNEW, ">$prefix/src/win32/WIN32-Includes/config.h.new");
38 while(<WIN32CONFIG>) {
39     if($_ =~ m/^\#define VERSION "[^"]+"/) {
40         $_ =~ s/^(\#define VERSION ")[^"]+(.*$)/${1}${version}${2}/;
41     }
42     print WIN32CONFIGNEW $_;
43 }
44 system("mv -f ${prefix}/src/win32/WIN32-Includes/config.h.new ${prefix}/src/win32/WIN32-Includes/config.h");
45
46 open(MANUAL, "<$prefix/doc/snort_manual.tex");
47 open(MANUALNEW, ">$prefix/doc/snort_manual.tex.new");
48 while(<MANUAL>) {
49     s/(Snort\\texttrademark  Users Manual\\\\ ).*?(\})/$1 $version $2/;
50     print MANUALNEW $_;
51 }
52 system("mv -f $prefix/doc/snort_manual.tex.new $prefix/doc/snort_manual.tex");
53
54 open(MANUAL, "<$prefix/rpm/snort.spec");
55 open(MANUALNEW, ">$prefix/rpm/snort.spec.new");
56 while(<MANUAL>) {
57     s/^Version: .*$/Version: $version/;
58     print MANUALNEW $_;
59 }
60 system("mv -f $prefix/rpm/snort.spec.new $prefix/rpm/snort.spec");
61
62 open (CONF, "<$prefix/etc/snort.conf");
63 open (CONFNEW,">$prefix/etc/snort.conf.new");
64 while (<CONF>) {
65     s/Snort .* Ruleset/Snort $version Ruleset/;
66     print CONFNEW $_;
67 }
68 system("mv -f $prefix/etc/snort.conf.new $prefix/etc/snort.conf");