| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | my $smapiurl = "http://voxel.dl.sourceforge.net/sourceforge/husky/smapi-2.2.4-src.tar.gz"; |
|---|
| 14 | my $os = $^O; |
|---|
| 15 | my $origsysop = "Mercyful Fate"; |
|---|
| 16 | use File::Copy; |
|---|
| 17 | use File::Find; |
|---|
| 18 | use Cwd; |
|---|
| 19 | my $trunk = getcwd; |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | system("clear"); |
|---|
| 24 | print "Welcome to the Enthral BBS install script.\n\n"; |
|---|
| 25 | print "This script will ask you for your Sysop Name and BBS Name and\n"; |
|---|
| 26 | print "then download and compile the smpai (which is required for Enthral),\n"; |
|---|
| 27 | print "add the sysop name to the config.ini file, and compile snoop and stats.\n\n"; |
|---|
| 28 | print "WARNING. I am not responsible for anything that might occur with your\n"; |
|---|
| 29 | print "system. While I have done my best to ensure that the script functions as\n"; |
|---|
| 30 | print "promised, things may go wrong from time to time. Please ensure you make\n"; |
|---|
| 31 | print "a complete backup of your system before attempting to use this.\n\n"; |
|---|
| 32 | print "Are you ready to continue? (y/n): "; |
|---|
| 33 | |
|---|
| 34 | if (<STDIN> =~ /^[yY]/) |
|---|
| 35 | { |
|---|
| 36 | print "\nSysop Name (Has to match exactly what you plan on using): "; |
|---|
| 37 | my $sysop = <>; |
|---|
| 38 | chomp ( $sysop ); |
|---|
| 39 | |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | chdir "ini/"; |
|---|
| 43 | my $dir = getcwd; |
|---|
| 44 | print "\nReplacing $origsysop with $sysop in config.ini\n\n"; |
|---|
| 45 | sleep 2; |
|---|
| 46 | find(\&wanted,$dir); |
|---|
| 47 | |
|---|
| 48 | print "\nFinished\n"; |
|---|
| 49 | sleep 2; |
|---|
| 50 | |
|---|
| 51 | sub wanted{ |
|---|
| 52 | |
|---|
| 53 | /\.ini$/ or return; |
|---|
| 54 | my $file=$_; |
|---|
| 55 | my $found = 0; |
|---|
| 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 | |
|---|
| 73 | sleep 2; |
|---|
| 74 | |
|---|
| 75 | |
|---|
| 76 | |
|---|
| 77 | chdir $trunk; |
|---|
| 78 | print "\nDownloading smapi-2.2.4-src.tar.gz\n"; |
|---|
| 79 | sleep 1; |
|---|
| 80 | |
|---|
| 81 | mkdir("/tmp/enthral", 0777) || print $!; |
|---|
| 82 | mkdir("smapi_src", 0777) || print $!; |
|---|
| 83 | chdir "smapi_src/"; |
|---|
| 84 | system "wget $smapiurl"; |
|---|
| 85 | |
|---|
| 86 | system "tar xzvf smapi-2.2.4-src.tar.gz"; |
|---|
| 87 | unlink <*.tar.gz*>; |
|---|
| 88 | print "\nsmapi-2.2.4-src.tar.gz successfully downloaded and unpacked.\n"; |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | chdir "smapi/"; |
|---|
| 92 | print "\nChecking OS."; |
|---|
| 93 | sleep 1; |
|---|
| 94 | print "\nRunning under $os\n"; |
|---|
| 95 | print "\nCompiling smapi\n"; |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | copy("makefile.lnx","Makefile") or die "Copy failed: $!"; |
|---|
| 99 | system "make"; |
|---|
| 100 | |
|---|
| 101 | print "\nlibsmapilnx.a compiled successfully. Moving to compile Enthral.\n"; |
|---|
| 102 | copy("libsmapilnx.a","../../src/libsmapilnx.a") or die "Copy failed: $!"; |
|---|
| 103 | chdir "../../"; |
|---|
| 104 | |
|---|
| 105 | sleep 1; |
|---|
| 106 | |
|---|
| 107 | print "\nBuilding Base Enthral System...\n\n"; |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | print "\nCleaning Root directory\n"; |
|---|
| 111 | sleep 1; |
|---|
| 112 | system "rm -f m4/{lt,lib}*.m4"; |
|---|
| 113 | |
|---|
| 114 | |
|---|
| 115 | print "\nRunning AutoMake (Autogen.sh)\n"; |
|---|
| 116 | sleep 1; |
|---|
| 117 | system "./autogen.sh"; |
|---|
| 118 | |
|---|
| 119 | |
|---|
| 120 | print "\nRunning configure\n"; |
|---|
| 121 | sleep 1; |
|---|
| 122 | system "make distclean"; |
|---|
| 123 | system "./configure"; |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | print "\nRunning make distclean\n"; |
|---|
| 127 | sleep 1; |
|---|
| 128 | system "make clean"; |
|---|
| 129 | |
|---|
| 130 | |
|---|
| 131 | print "\nRunning make\n"; |
|---|
| 132 | sleep 1; |
|---|
| 133 | system "make"; |
|---|
| 134 | |
|---|
| 135 | |
|---|
| 136 | chdir "src/stats"; |
|---|
| 137 | print "\nCompiling Stats\n"; |
|---|
| 138 | system "g++ -o stats main.cpp process2.cpp userdat.cpp"; |
|---|
| 139 | sleep 1; |
|---|
| 140 | print "\nStats compile succsessful\n"; |
|---|
| 141 | |
|---|
| 142 | |
|---|
| 143 | chdir "../snoop"; |
|---|
| 144 | print "\nCompiling Snoop\n"; |
|---|
| 145 | system "g++ -o snoop snoop.cpp"; |
|---|
| 146 | sleep 1; |
|---|
| 147 | print "\nSnoop compile succsessful\n"; |
|---|
| 148 | |
|---|
| 149 | print "\nCongradulations, Enthral compile complete.\n\n"; |
|---|
| 150 | print "\nA couple install notes, make sure you have read/write permissions set.\n"; |
|---|
| 151 | print "\nIt's very important to check/set all read/write permissions for your bbs user.\n"; |
|---|
| 152 | |
|---|
| 153 | } |
|---|