|
@@ -3,7 +3,7 @@
|
|
# by lighta
|
|
# by lighta
|
|
# TODO:
|
|
# TODO:
|
|
# - Don't always override import/file, sed grep ?
|
|
# - Don't always override import/file, sed grep ?
|
|
-
|
|
|
|
|
|
+use lib '.';
|
|
use File::Basename;
|
|
use File::Basename;
|
|
use DBI;
|
|
use DBI;
|
|
use DBD::mysql;
|
|
use DBD::mysql;
|
|
@@ -13,15 +13,19 @@ use Getopt::Long;
|
|
use Net::Ping;
|
|
use Net::Ping;
|
|
use strict;
|
|
use strict;
|
|
use rA_Common;
|
|
use rA_Common;
|
|
|
|
+use LWP::Simple;
|
|
|
|
|
|
use constant {
|
|
use constant {
|
|
SERV_UID => "Serv_userid",
|
|
SERV_UID => "Serv_userid",
|
|
SERV_PW => "Serv_userpass",
|
|
SERV_PW => "Serv_userpass",
|
|
|
|
+ LOGIN_PRIV_IP => "login_priv_ip",
|
|
|
|
+ CHAR_PRIV_IP => "char_priv_ip",
|
|
SERV_WAN_IP => "Serv_wan_ip",
|
|
SERV_WAN_IP => "Serv_wan_ip",
|
|
MAP_PORT => "Map_port",
|
|
MAP_PORT => "Map_port",
|
|
CHAR_PORT => "Char_port",
|
|
CHAR_PORT => "Char_port",
|
|
LOGIN_PORT => "Login_port",
|
|
LOGIN_PORT => "Login_port",
|
|
MD5_ENABLE => "enable_MD5",
|
|
MD5_ENABLE => "enable_MD5",
|
|
|
|
+ PINCODE_ENABLE => "enable_pincode",
|
|
SQL_HOST => "SQL_host",
|
|
SQL_HOST => "SQL_host",
|
|
SQL_PORT => "SQL_port",
|
|
SQL_PORT => "SQL_port",
|
|
SQL_UID => "SQL_userid",
|
|
SQL_UID => "SQL_userid",
|
|
@@ -87,13 +91,17 @@ sub Main {
|
|
chdir $dir; #put ourself like was called in tools
|
|
chdir $dir; #put ourself like was called in tools
|
|
print "Running rAthena's configuration tool...\n";
|
|
print "Running rAthena's configuration tool...\n";
|
|
#default conf
|
|
#default conf
|
|
|
|
+ my $pubip = GetPublicIP();
|
|
my %hDefConf = ( SERV_UID => "s1",
|
|
my %hDefConf = ( SERV_UID => "s1",
|
|
SERV_PW => "p1",
|
|
SERV_PW => "p1",
|
|
- SERV_WAN_IP => "localhost",
|
|
|
|
|
|
+ SERV_WAN_IP => $pubip || "localhost",
|
|
|
|
+ LOGIN_PRIV_IP => "localhost",
|
|
|
|
+ CHAR_PRIV_IP => "localhost",
|
|
MAP_PORT => "5121",
|
|
MAP_PORT => "5121",
|
|
CHAR_PORT => "6121",
|
|
CHAR_PORT => "6121",
|
|
LOGIN_PORT => "6900",
|
|
LOGIN_PORT => "6900",
|
|
MD5_ENABLE => "yes",
|
|
MD5_ENABLE => "yes",
|
|
|
|
+ PINCODE_ENABLE => "no",
|
|
SQL_HOST => "localhost",
|
|
SQL_HOST => "localhost",
|
|
SQL_PORT => "3306",
|
|
SQL_PORT => "3306",
|
|
SQL_UID => "ragnarok",
|
|
SQL_UID => "ragnarok",
|
|
@@ -101,6 +109,7 @@ sub Main {
|
|
SQL_MAIN_DB => "ragnarok",
|
|
SQL_MAIN_DB => "ragnarok",
|
|
SQL_LOG_DB => ,"ragnarok",
|
|
SQL_LOG_DB => ,"ragnarok",
|
|
);
|
|
);
|
|
|
|
+
|
|
|
|
|
|
my $sBasedir = getcwd; #for setupdb
|
|
my $sBasedir = getcwd; #for setupdb
|
|
if($sTarget =~ /All|Inst/i){ InstallSoft(); }
|
|
if($sTarget =~ /All|Inst/i){ InstallSoft(); }
|
|
@@ -173,6 +182,15 @@ sub EnableCoredump {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+sub GetPublicIP {
|
|
|
|
+ print "\n== Resolving Public IP_addr";
|
|
|
|
+ my $content = get("http://checkip.dyndns.org");
|
|
|
|
+ $content =~ s/.*Current IP Address: ([\d.]+).*/$1/;
|
|
|
|
+ $content =~ s/\r|\n//gm;
|
|
|
|
+ print "\n found = $content ==\n";
|
|
|
|
+ return $content;
|
|
|
|
+}
|
|
|
|
+
|
|
sub GetOS {
|
|
sub GetOS {
|
|
#yes we could $^0 or uname -r but $^0 only give perl binary build OS and uname hmm...
|
|
#yes we could $^0 or uname -r but $^0 only give perl binary build OS and uname hmm...
|
|
open PIPE,"lsb_release -i |" or die $!;
|
|
open PIPE,"lsb_release -i |" or die $!;
|
|
@@ -297,7 +315,8 @@ sub ApplyMapConf { my ($rhUserConf,$sCurfile) = @_;
|
|
print FILE "passwd: " . $$rhUserConf{SERV_PW}."\n\n";
|
|
print FILE "passwd: " . $$rhUserConf{SERV_PW}."\n\n";
|
|
|
|
|
|
print FILE "map_ip: " . $$rhUserConf{SERV_WAN_IP}."\n";
|
|
print FILE "map_ip: " . $$rhUserConf{SERV_WAN_IP}."\n";
|
|
- print FILE "map_port: " . $$rhUserConf{MAP_PORT}."\n";
|
|
|
|
|
|
+ print FILE "map_port: " . $$rhUserConf{MAP_PORT}."\n";
|
|
|
|
+ print FILE "char_ip: " . $$rhUserConf{CHAR_PRIV_IP}."\n";
|
|
print FILE "char_port: " . $$rhUserConf{CHAR_PORT}."\n";
|
|
print FILE "char_port: " . $$rhUserConf{CHAR_PORT}."\n";
|
|
}
|
|
}
|
|
|
|
|
|
@@ -305,10 +324,13 @@ sub ApplyCharConf { my ($rhUserConf,$sCurfile) = @_;
|
|
open FILE, "> $sCurfile" || die "Couldn't open file '$sCurfile'.\n";
|
|
open FILE, "> $sCurfile" || die "Couldn't open file '$sCurfile'.\n";
|
|
print FILE "userid: " . $$rhUserConf{SERV_UID}."\n";
|
|
print FILE "userid: " . $$rhUserConf{SERV_UID}."\n";
|
|
print FILE "passwd: " . $$rhUserConf{SERV_PW}."\n\n";
|
|
print FILE "passwd: " . $$rhUserConf{SERV_PW}."\n\n";
|
|
-
|
|
|
|
|
|
+
|
|
print FILE "char_ip: " . $$rhUserConf{SERV_WAN_IP}."\n";
|
|
print FILE "char_ip: " . $$rhUserConf{SERV_WAN_IP}."\n";
|
|
print FILE "char_port: " . $$rhUserConf{CHAR_PORT}."\n";
|
|
print FILE "char_port: " . $$rhUserConf{CHAR_PORT}."\n";
|
|
|
|
+ print FILE "login_ip: " . $$rhUserConf{LOGIN_PRIV_IP}."\n";
|
|
print FILE "login_port: " . $$rhUserConf{LOGIN_PORT}."\n";
|
|
print FILE "login_port: " . $$rhUserConf{LOGIN_PORT}."\n";
|
|
|
|
+
|
|
|
|
+ print FILE "pincode_enabled: " . $$rhUserConf{PINCODE_ENABLE}."\n";
|
|
}
|
|
}
|
|
|
|
|
|
sub ApplyLoginConf { my ($rhUserConf,$sCurfile) = @_;
|
|
sub ApplyLoginConf { my ($rhUserConf,$sCurfile) = @_;
|