root/trunk/install.pl

Revision 150, 4.1 kB (checked in by mercyful, 2 years ago)

opps.. readd install.pl perl script :)

  • Property svn:keywords set to LastChangedDate LastChangedRevision LastChangedBy Id
Line 
1#! /usr/bin/perl -w
2
3# Enthral SVN: $Id$
4# Source: $HeadURL: http://svn.enthralbbs.com/trunk/install.pl $
5# $LastChangedDate$
6# $LastChangedRevision$
7# $LastChangedBy$
8
9# Enthral BBS Auto Install script
10
11# Standard variables and system requests
12
13my $smapiurl = "http://voxel.dl.sourceforge.net/sourceforge/husky/smapi-2.2.4-src.tar.gz";
14my $os = $^O;
15my $origsysop = "Mercyful Fate";
16use File::Copy;
17use File::Find;
18use Cwd;
19my $trunk = getcwd;
20
21# Capture User Input
22
23system("clear");
24print "Welcome to the Enthral BBS install script.\n\n";
25print "This script will ask you for your Sysop Name and BBS Name and\n";
26print "then download and compile the smpai (which is required for Enthral),\n";
27print "add the sysop name to the config.ini file, and compile snoop and stats.\n\n";
28print "WARNING. I am not responsible for anything that might occur with your\n";
29print "system.  While I have done my best to ensure that the script functions as\n";
30print "promised, things may go wrong from time to time.  Please ensure you make\n";
31print "a complete backup of your system before attempting to use this.\n\n";
32print "Are you ready to continue? (y/n): ";
33
34if (<STDIN> =~ /^[yY]/)
35{
36print "\nSysop Name (Has to match exactly what you plan on using): ";
37my $sysop = <>;
38chomp ( $sysop );
39
40# Replace Sysop Name in config.ini
41
42chdir "ini/";
43my $dir = getcwd;
44print "\nReplacing $origsysop with $sysop in config.ini\n\n";
45sleep 2;
46find(\&wanted,$dir);
47
48print "\nFinished\n";
49sleep 2;
50
51sub wanted{
52#       (-f $_ && -w $_ && -T $_) or return;
53        /\.ini$/ or return;
54        my $file=$_;
55        my $found = 0; # If the string was found in $file
56        print "Searching $file.\n";
57        open(INFILE,$file) or (print "Could not open $file for reading: $!\n" and return);
58        my @text=<INFILE>;
59        close(INFILE);
60        for(my $x=0;$x<=$#text;$x++){
61                $text[$x]=~s/$origsysop/$sysop/g and $found = 1 and
62                        print " -Found in $file (line ".($x+1).")\n";
63        }
64        if($found){
65                open(OUTFILE,">$file") or (print "Unable to open $file for writing: $!\n\t$file must be changed manually\n." and return);
66                foreach(@text){
67                        print OUTFILE $_;
68                }
69                close(OUTFILE);
70        }
71}
72
73sleep 2;
74
75
76# Download and unpack smapi 2.2
77chdir $trunk;
78print "\nDownloading smapi-2.2.4-src.tar.gz\n";
79sleep 1;
80
81mkdir("/tmp/enthral", 0777) || print $!;
82mkdir("smapi_src", 0777) || print $!;
83chdir "smapi_src/";
84system "wget $smapiurl";
85
86system "tar xzvf smapi-2.2.4-src.tar.gz";
87unlink <*.tar.gz*>;
88print "\nsmapi-2.2.4-src.tar.gz successfully downloaded and unpacked.\n";
89
90# Configuring smapi
91chdir "smapi/";
92print "\nChecking OS.";
93sleep 1;
94print "\nRunning under $os\n";
95print "\nCompiling smapi\n";
96
97# makefile.lnx compiles for both linux and bsd.
98copy("makefile.lnx","Makefile") or die "Copy failed: $!";
99system "make";
100
101print "\nlibsmapilnx.a compiled successfully.  Moving to compile Enthral.\n";
102copy("libsmapilnx.a","../../src/libsmapilnx.a") or die "Copy failed: $!";
103chdir "../../";
104
105sleep 1;
106
107print "\nBuilding Base Enthral System...\n\n";
108
109# Cleaning any left over files
110print "\nCleaning Root directory\n";
111sleep 1;
112system "rm -f m4/{lt,lib}*.m4";
113
114# run AutoMake
115print "\nRunning AutoMake (Autogen.sh)\n";
116sleep 1;
117system "./autogen.sh";
118
119# run Configure
120print "\nRunning configure\n";
121sleep 1;
122system "make distclean";
123system "./configure";
124
125# run make clean
126print "\nRunning make distclean\n";
127sleep 1;
128system "make clean";
129
130# run make
131print "\nRunning make\n";
132sleep 1;
133system "make";
134
135# compile stats
136chdir "src/stats";
137print "\nCompiling Stats\n";
138system "g++ -o stats main.cpp process2.cpp userdat.cpp";
139sleep 1;
140print "\nStats compile succsessful\n";
141
142# compile snoop
143chdir "../snoop";
144print "\nCompiling Snoop\n";
145system "g++ -o snoop snoop.cpp";
146sleep 1;
147print "\nSnoop compile succsessful\n";
148
149print "\nCongradulations, Enthral compile complete.\n\n";
150print "\nA couple install notes, make sure you have read/write permissions set.\n";
151print "\nIt's very important to check/set all read/write permissions for your bbs user.\n";
152
153}
Note: See TracBrowser for help on using the browser.