Fix tools/config.pl
Add current path to @inc Add more support for public_ip / private_ip. Add pincode support
This commit is contained in:
parent
cdbb14b90d
commit
03da2f6854
@ -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",
|
||||||
@ -102,6 +110,7 @@ sub Main {
|
|||||||
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(); }
|
||||||
if($sTarget =~ /All|Conf/i) { ConfigConf(\%hDefConf); chdir "$sBasedir"; }
|
if($sTarget =~ /All|Conf/i) { ConfigConf(\%hDefConf); chdir "$sBasedir"; }
|
||||||
@ -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 $!;
|
||||||
@ -298,6 +316,7 @@ sub ApplyMapConf { my ($rhUserConf,$sCurfile) = @_;
|
|||||||
|
|
||||||
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,7 +327,10 @@ sub ApplyCharConf { my ($rhUserConf,$sCurfile) = @_;
|
|||||||
|
|
||||||
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) = @_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user