root/trunk/update.pl

Revision 117, 4.1 kB (checked in by mercyful, 3 years ago)

Enthral BBS Build 0.428 Alpha
Check ChangeLog? for all Updates.

  • Property svn:executable set to *
  • Property svn:keywords set to ID LastChangedDate LastChangedRevision LastChangedBy HeadURL
Line 
1#! /usr/bin/perl -w
2
3# Enthral SVN: $Id$
4# Source: $HeadURL$
5# $LastChangedDate$
6# $LastChangedRevision$
7# $LastChangedBy$
8
9# Enthral BBS perl updater script.  Written by Frank Linhares
10# For more info on the Enthral bbs project please visit
11# http://enthralbbs.com
12#
13# This perl script will attempt to automatically update your current Enthral
14# alpha to the latest version via svn as well as change any instances of the
15# default sysop and bbs name for you.  The script will then run
16# ./configure && make clean && make for you as well as compile snoop and stats.
17#
18# WARNING.  This script was originally created for my own personal use.
19# I am not responsible for anything that it might cause to your Enthral
20# system.  While I have done my best to ensure that the script functions as
21# promised, things may go wrong from time to time.  Please ensure you make
22# a complete backup of your system before attempting to use this.
23#
24# Usage:
25#
26# ./update.pl
27#
28# Enter in your Sysop name and your BBS name.
29
30# Standard variables and system requests
31
32use File::Find;
33use Cwd;
34use File::Copy;
35use strict;
36
37my $enthralsvn = "http://svn.enthralbbs.com/trunk";
38my $origsysop = "Mercyful Fate";
39my $trunk = getcwd;
40
41# Capture User Input
42
43system("clear");
44print "Welcome to the Enthral BBS auto updater script.\n\n";
45print "This script will ask you for your Sysop Name and BBS Name and then\n";
46print "update your src to the latest build via svn, replace all instances of\n";
47print "the deafult sysop and bbs name and run configure, make clean, and\n";
48print "make for you.  It will also compile snoop and stats.\n\n";
49print "This script assumes that you have already compiled husky's smapi library\n";
50print "and have the libsmapilnx.a library in your trunk path.\n\n";
51print "WARNING.  This script was originally created for my own personal use.\n";
52print "I am not responsible for anything that it might cause to your Enthral\n";
53print "system.  While I have done my best to ensure that the script functions as\n";
54print "promised, things may go wrong from time to time.  Please ensure you make\n";
55print "a complete backup of your system before attempting to use this.\n\n";
56print "Are you ready to continue? (y/n): ";
57
58if (<STDIN> =~ /^[yY]/)
59
60{
61print "\nSysop Name : ";
62my $sysop = <>;
63chomp ( $sysop );
64
65# Run SVN
66chdir "../";
67print "\nChecking SVN for any updates.\n";
68sleep 1;
69system("svn --username svn co $enthralsvn") == 0 or die "SVN update failed ($?): $!";
70print "\nSVN check out succesfull. On to Sysop and BBS name replace.\n";
71sleep 1;
72chdir "trunk/ini/";
73my $dir = getcwd;
74
75# Replace Sysop Name in source
76
77print "\nSearching for: $origsysop\nReplacing with: $sysop\n\n";
78sleep 1;
79find(\&wanted,$dir);
80
81print "\nFinished\n";
82sleep 1;
83
84sub wanted{
85#       (-f $_ && -w $_ && -T $_) or return;
86        /\.ini$/ or return;
87        my $file=$_;
88        my $found = 0; # If the string was found in $file
89        print "Searching $file.\n";
90        open(INFILE,$file) or (print "Could not open $file for reading: $!\n" and return);
91        my @text=<INFILE>;
92        close(INFILE);
93        for(my $x=0;$x<=$#text;$x++){
94                $text[$x]=~s/$origsysop/$sysop/g and $found = 1 and
95                        print " -Found in $file (line ".($x+1).")\n";
96        }
97        if($found){
98                open(OUTFILE,">$file") or (print "Unable to open $file for writing: $!\n\t$file must be changed manually\n." and return);
99                foreach(@text){
100                        print OUTFILE $_;
101                }
102                close(OUTFILE);
103        }
104}
105
106sleep 1;
107
108# run Configure
109chdir $trunk;
110print "\nRunning configure\n";
111sleep 1;
112system "./configure";
113
114# run make clean
115print "\nRunning make clean\n";
116sleep 1;
117system "make clean";
118
119# run make
120print "\nRunning make\n";
121sleep 1;
122system "make";
123
124# compile stats
125chdir "src/stats";
126print "\nCompiling Stats\n";
127system "g++ -o stats main.cpp process2.cpp userdat.cpp";
128sleep 1;
129print "\nStats compile succsessful\n";
130
131# compile snoop
132chdir "../snoop";
133print "\nCompiling Snoop\n";
134system "g++ -o snoop snoop.cpp";
135sleep 1;
136print "\nSnoop compile succsessful\n";
137
138print "\nEnthral update and compalation complete.\n\n";
139}
Note: See TracBrowser for help on using the browser.