Cleaning scripts in 'tools/'.

Fixed spelling/grammar for most output messages.

Updated references to 'make sql' to 'make server'.

Signed-off-by: Euphy <euphy.raliel@rathena.org>
This commit is contained in:
Euphy 2015-01-04 20:47:20 -05:00
parent 357aa0489f
commit 8897ad72ac
10 changed files with 157 additions and 153 deletions

View File

@ -97,9 +97,9 @@ help:
@echo "'all' - builds all the above targets"
@echo "'server' - builds servers (targets 'common' 'login' 'char' 'map' and 'import')"
@echo "'clean' - cleans builds and objects"
@echo "'install' - run installer wich setup rathena in /opt/"
@echo "'bin-clean' - delete binary installed"
@echo "'uninstall' - run uninstaller wich erase all install change"
@echo "'install' - run installer which sets up rathena in /opt/"
@echo "'bin-clean' - deletes installed binaries"
@echo "'uninstall' - run uninstaller which erases all installation changes"
@echo "'help' - outputs this message"
needs_mysql:

View File

@ -5,12 +5,12 @@ Build Status: [![Build Status](https://travis-ci.org/rathena/rathena.png?branch=
Table of Contents
---------
* 1 What is rAthena?
* 2 Prerequisites
* 3 Installation
* 4 Troubleshooting
* 5 Helpful Links
* 6 More Documentation
1. What is rAthena?
2. Prerequisites
3. Installation
4. Troubleshooting
5. Helpful Links
6. More Documentation
1. What is rAthena?
---------
@ -90,7 +90,7 @@ relevant to your Operation System, please refer to the Wiki (links at the end of
mysql --user=root -p rathena_rag < trunk/sql-files/main.sql (and others)
* Configure and compile:
./configure && make clean && make sql
./configure && make clean && make server
* When you're ready, start the servers:
./athena-start start

View File

@ -3,7 +3,7 @@
//===== By: ==================================================
//= rAthena Dev Team
//===== Last Updated: ========================================
//= 20131112
//= 20150104
//===== Description: =========================================
//= Basic information and installation guide with links to
//= various forum posts and Wiki articles.
@ -95,7 +95,7 @@ Linux
* Insert SQL files:
mysql --user=root -p rathena_rag < trunk/sql-files/main.sql (and others)
* Configure and compile:
./configure && make clean && make sql
./configure && make clean && make server
* When you're ready, start the servers:
./athena-start start

View File

@ -1,5 +1,6 @@
#!/usr/bin/perl
# building documentation using doxygen and updation versionning number
# Documentation Builder
# Builds documentation using doxygen and updates version number.
use strict;
use File::Basename;
use Getopt::Long;
@ -19,8 +20,8 @@ Main();
sub GetArgs {
GetOptions(
'doxyconf=s' => \$sDocFile, #specify the doxygen configuration file
'outdir=s' => \$outputdir, #specify in wich folder to build the documentation
'ignorechk=s' => \$sIgnChk, #Target (wich setup to run)
'outdir=s' => \$outputdir, #specify in which folder to build the documentation
'ignorechk=s' => \$sIgnChk, #Target (which setup to run)
'forcebuild=i' => \$sForceBuild, #should we chk if all doc are linked to a src ?
'noupd=i' => \$sNoUpd, #prevent altering doxygen conf
'help!' => \$sHelp,
@ -28,16 +29,16 @@ sub GetArgs {
if( $sHelp ) {
print "Incorect option specified, available option are:\n"
."\t --doxyconf filename => specify wich doxygen configuration to use\n"
."\t --outdir path => specify in wich path to build doxygen documentation\n"
."\t --doxyconf filename => specify which doxygen configuration to use\n"
."\t --outdir path => specify in which path to build doxygen documentation\n"
."\t --forcebuild=0|1 => should we force building of documentation even if same git detected ?\n"
."\t --noupd=0|1 => should we skip producing a new doxyconf for version ?\n"
."\t --ignorechk => target (specify wich check to ignore [$sValidTarget])\n";
."\t --ignorechk => target (specify which check to ignore [$sValidTarget])\n";
exit;
}
if($sIgnChk && !($sIgnChk =~ /$sValidTarget/i)){
print "Incorect ignorechk target specified, available target are:\n"
."\t --ignorechk => target (specify wich check to ignore [(default)$sValidTarget])\n";
print "Incorect ignorechk target specified. Available targets:\n"
."\t --ignorechk => target (specify which check to ignore [(default)$sValidTarget])\n";
exit;
}
}
@ -76,7 +77,7 @@ sub DoxygenChk {
chomp($doxyversion); #remove newline
print "doxyversion = [ $doxyversion ]\n";
if($doxyversion eq ""){
die "Please install doxygen to proceed";
die "Please install doxygen to proceed.";
}
close PIPE;
return $doxyversion;
@ -94,7 +95,7 @@ sub GitChk {
chomp($gitversion);
print "git = [ $gitversion ]\n";
if($gitversion eq ""){
die "Please install git to proceed";
die "Please install git to proceed.";
}
close PIPE;
return $gitversion;

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
# checking-doc original script by trojal
# modified by lighta
# Documentation Checker
# by trojal (modified by lighta)
use strict;
use File::Basename;
@ -46,12 +46,12 @@ sub GetArgs {
exit;
}
unless($sTarget =~ /$sValidTarget/i){
print "Incorrect target specified, available target is:\n"
print "Incorrect target specified. Available targets:\n"
."\t --target => target (specify wich check to run [(default)$sValidTarget])\n";
exit;
}
unless($sCmd =~ /$sValidCmd/i){
print "Incorrect command specified, available command is:\n"
print "Incorrect command specified. Available commands:\n"
."\t --cmd => cmd (specify wich command to run [(default)$sValidCmd])\n";
exit;
}
@ -97,7 +97,7 @@ sub Script_GetCmd {
my @aDef_sct = ();
foreach my $sSct_srcf (@aSct_src){
unless(open FILE_SRC, "<$sSct_srcf") {
print "couldn't open file $sSct_srcf \n";
print "Couldn't open file '$sSct_srcf'.\n";
next;
}
while(<FILE_SRC>){
@ -128,7 +128,7 @@ sub Script_Chk { my ($raDef_sct) = @_;
foreach my $sSct_docf (@aSct_docf){
unless(open FILE_DOC, "$sSct_docf"){
print "couldn't open file $sSct_docf \n";
print "Couldn't open file '$sSct_docf'.\n";
next;
}
while(<FILE_DOC>){
@ -157,18 +157,18 @@ sub Script_Chk { my ($raDef_sct) = @_;
}
print "}\n\n";
}
else { print "All script command in Src are documented, no issues found\n"; }
else { print "All script commands in src are documented, no issues found.\n"; }
if($sLeftOverChk){
my $raLeftover_sct = Chk(\@aDoc_sct,$raDef_sct); #we just inverse the chk for leftover
if(scalar(@$raLeftover_sct)){
print "Those script command was found in doc but no source associated, leftover ? :{\n";
print "These script commands were found in doc with no associated source:{\n";
foreach(@$raLeftover_sct){
print "\t$_ \n";
}
print "}\n\n";
}
else { print "All script command in documentation match a source BUILDIN, no leftover found\n"; }
else { print "All script commands in documentation match a source BUILDIN, no leftovers found.\n"; }
}
}
@ -177,7 +177,7 @@ sub Atc_GetCmd {
my @aDef_act = ();
foreach my $sAct_srcf (@aAct_src){
unless(open FILE_SRC, "<$sAct_srcf"){
print "couldn't open file $sAct_srcf \n";
print "Couldn't open file '$sAct_srcf'.\n";
next;
}
while(<FILE_SRC>){
@ -210,7 +210,7 @@ sub Atc_Chk { my ($raDef_act) = @_;
foreach my $sAct_docf (@aAct_docf){
unless(open FILE_DOC, "$sAct_docf"){
print "couldn't open file $sAct_docf \n";
print "Couldn't open file '$sAct_docf'.\n";
next;
}
while(<FILE_DOC>){
@ -235,17 +235,17 @@ sub Atc_Chk { my ($raDef_act) = @_;
}
print "}\n\n";
}
else { print "All atcommand in Src are documented, no issues found\n"; }
else { print "All atcommands in src are documented, no issues found.\n"; }
if($sLeftOverChk){
my $raLeftover_sct = Chk(\@aDoc_act,$raDef_act); #we just inverse the chk for leftover
if(scalar(@$raLeftover_sct)){
print "Those atcommands were found in doc but no source associated, leftover ? : {\n";
print "These atcommands were found in doc with no associated source: {\n";
foreach(@$raLeftover_sct){
print "\t$_ \n";
}
print "}\n\n";
}
else { print "All atcommands in documentation match a source ATCMD, no leftover found\n"; }
else { print "All atcommands in documentation match a source ATCMD, no leftovers found.\n"; }
}
}

View File

@ -1,7 +1,8 @@
#!/usr/bin/perl
# config script by lighta
#TODO list :
#- don't always override import/file, sed grep ?
# rAthena Configuration Script
# by lighta
# TODO:
# - Don't always override import/file, sed grep ?
use File::Basename;
use DBI;
@ -36,7 +37,7 @@ use constant {
MIN_PORT => 2000, #below are usually reserved for system
MAX_PORT => 65535,
};
# setup my defaults option
# setup default options
my $sDsdFile = DESD_CONF_FILE;
my $sAutoyes = 0;
my $sForce = 0;
@ -52,32 +53,31 @@ sub GetArgs {
'f=s' => \$sDsdFile, #give desired conf file
'auto=i' => \$sAutoyes, #Force (auto-yes)
'C=i' => \$sClean, #Clean (like force but remove before adding)
'target=s' => \$sTarget, #Target (wich setup to run)
'target=s' => \$sTarget, #Target (which setup to run)
'Force=i' => \$sForce, #Force (bypass verification)
'OS=s' => \$sOS, #OS (specify the os you wish to use)
'OS=s' => \$sOS, #OS (specify the OS you wish to use)
'help!' => \$sHelp,
) or $sHelp=1; #display help if invalid option
my $sValidTarget = "All|Conf|DB|Inst|Dump";
if( $sHelp ) {
print "Incorect option specified, available option are:\n"
print "Incorrect option specified. Available options are:\n"
."\t --f filename => file (specify desiredconf to use)\n"
."\t --auto => auto-yes to question ? \n"
."\t --auto => auto-yes to question? \n"
."\t --C => Clean (remove file, db, user before adding new)\n"
."\t --target => target (specify wich setup to run [$sValidTarget])\n"
."\t --target => target (specify which setup to run [$sValidTarget])\n"
."\t --Force => Force (bypass verification)\n"
."\t --OS => (specify the os you wish to use and avoid check)";
."\t --OS => (specify the OS you wish to use and avoid check)";
exit;
}
unless($sTarget =~ /$sValidTarget/i){
print "Incorect target specified, available target are:\n"
."\t --target => target (specify wich setup to run [(default)$sValidTarget])\n";
print "Incorrect target specified. Available targets are:\n"
."\t --target => target (specify which setup to run [(default)$sValidTarget])\n";
exit;
}
if($sDsdFile ne DESD_CONF_FILE && !(-e -r $sDsdFile)){
print "Incorect file specified: '$sDsdFile'\n"
."\t this file doesn't seem to appear on filesystem or unable to read\n";
print "File '$sDsdFile' could not be read or does not exist.\n";
exit;
}
}
@ -85,7 +85,7 @@ sub GetArgs {
sub Main {
my($filename, $dir, $suffix) = fileparse($0);
chdir $dir; #put ourself like was called in tools
print "Welcome to athena config-tool\n";
print "Running rAthena's configuration tool...\n";
#default conf
my %hDefConf = ( SERV_UID => "s1",
SERV_PW => "p1",
@ -107,13 +107,13 @@ sub Main {
if($sTarget =~ /All|Conf/i) { ConfigConf(\%hDefConf); chdir "$sBasedir"; }
if($sTarget =~ /All|DB/i) { ConfigDB(\%hDefConf); chdir "$sBasedir"; }
if($sTarget =~ /All|Dump/i) { chdir "~"; EnableCoredump(); }
print "Config done, you should be able to launch and connect server now\n";
print "NB : Don't forget to update your client clieninfo.xml to match change\n";
print "Setup successful. You can now launch and connect to the servers.\n";
print "(Remember to update the client's 'clientinfo.xml' to match your changes.)\n";
}
sub EnableCoredump {
print "\n Starting Enabling coredump \n";
print "\n== Enabling Coredumps ==\n";
my $sCurfile = "~/.bashrc";
my @lines = ();
my $sJump = .0;
@ -126,9 +126,9 @@ sub EnableCoredump {
push(@lines,$_) if /ulimit/;
}
if(scalar(@lines)>0){
print "ulimit instruction found in file=$sCurfile\n"
print "ulimit instruction found in file '$sCurfile'.\n"
."\t lines= \n @lines \n"
."are you sure you want to continue ? [y/n] \n";
."Are you sure you want to continue? [y/n] \n";
$sJump=1 if(GetValidAnwser("y|o|n",$sAutoyes) =~ /n/i);
}
system("sudo echo \"ulimit -c unlimited\" >> $sCurfile") if $sJump==0;
@ -149,7 +149,7 @@ sub EnableCoredump {
}
close FILE;
close FILE_TMP;
system("sudo mv tmp_limits.conf /etc/security/limits.conf") if $sJump==1; #don't overwritte if some config was already in there
system("sudo mv tmp_limits.conf /etc/security/limits.conf") if $sJump==1; #don't overwrite if some config was already in there
unlink "tmp_limits.conf";
}
@ -160,9 +160,9 @@ sub EnableCoredump {
push(@lines,$_) if /^kernel.core/;
}
if(scalar(@lines)>0){
print "ulimit instruction found in file=$sCurfile\n"
print "ulimit instruction found in file '$sCurfile'.\n"
."\t line= \n @lines \n"
."are you sure you want to continue ? [y/n] \n";
."Are you sure you want to continue? [y/n] \n";
$sJump=2 if(GetValidAnwser("y|o|n",$sAutoyes) =~ /n/i);
}
unless($sJump==2){
@ -187,7 +187,7 @@ sub GetOS {
my @aSupportedOS = ("Debian","Ubuntu","Fedora","CentOs","FreeBSD");
my $sOSregex = join("|",@aSupportedOS);
until($sOS =~ /$sOSregex/i){
print "Please enter your OS:[$sOSregex] or enter 'quit' to exit\n";
print "Please enter your OS [$sOSregex] or enter 'quit' to exit.\n";
$sOS = <>; chomp($sOS);
last if($sOS eq "quit");
}
@ -196,10 +196,10 @@ sub GetOS {
}
sub InstallSoft {
print "\n Starting InstallSoft \n";
print "This autoinstall feature is experimental, package name varies from distri and version, couldn't support them all\n";
print "\n== Installing Software ==\n";
print "NOTE: This auto-install feature is experimental. Package names vary in different distributions and versions, so they may be incorrect.\n";
$sOS = GetOS() unless $sOS;
if($sOS eq "quit"){ print "Skipping Software installation\n"; return; }
if($sOS eq "quit"){ print "Skipping software installation...\n"; return; }
elsif($sOS =~ /Ubuntu|Debian/i) { #tested on ubuntu 12.10,13.10
my @aListSoft = ("gcc","gdb","zlibc","zlib1g-dev","make","git","mysql-client","mysql-server","mysql-common","libmysqlclient-dev","phpmyadmin","libpcre3-dev");
print "Going to install: @aListSoft\n";
@ -225,11 +225,11 @@ sub InstallSoft {
}
sub ConfigConf { my ($rhDefConf) = @_;
print "\n Starting ConfigConf \n";
print "\n== Setting Configurations ==\n";
my $rhUserConf;
while(1) {
$rhUserConf = GetDesiredConf($rhDefConf);
print "SetupConf using conf : \n";
print "SetupConf using conf: \n";
ShowConfig($rhUserConf);
last if($sForce || AutoCheckConf($rhUserConf));
}
@ -237,11 +237,11 @@ sub ConfigConf { my ($rhDefConf) = @_;
}
sub ConfigDB { my ($rhDefConf) = @_;
print "\n Starting ConfigDB \n";
print "\n== Setting Up Databases ==\n";
my $rhUserConf;
while(1) {
$rhUserConf = GetDesiredConf($rhDefConf);
print "SetupDb using conf : \n";
print "SetupDb using conf: \n";
ShowConfig($rhUserConf);
last if($sForce || AutoCheckConf($rhUserConf));
}
@ -250,18 +250,18 @@ sub ConfigDB { my ($rhDefConf) = @_;
#conf function
sub ApplySetupConf { my ($rhConfig) = @_;
print "\nApplying conf \n";
print "\nApplying configurations...\n";
my @aTargetfile = (MAP_CONF_FILE,CHAR_CONF_FILE,LOGIN_CONF_FILE,INTER_CONF_FILE);
my $sConfDir = "conf";
my $sUserConfDir = "import";
die "$sConfDir doesn't seem to exist or coudldn't be read/writte" unless(-d -r -w "../$sConfDir");
die "'$sConfDir' doesn't seem to exist or couldn't be read/written" unless(-d -r -w "../$sConfDir");
chdir "../$sConfDir";
print "Saving tmp user-conf \n";
print "Saving tmp user-conf.\n";
YAML::XS::DumpFile(DESD_CONF_FILE,$rhConfig);
unless(-d "$sUserConfDir") {
print "conf/import directory doesn't exist, create it ? [y/n] (will be generated by compilation otherwise) \n";
if(GetValidAnwser("y|o|n",$sAutoyes) =~ /n/i) { die "Couldn't apply conf without import folder\n"; }
print "Directory 'conf/import' doesn't exist. Create it? [y/n] (will be generated by compilation otherwise) \n";
if(GetValidAnwser("y|o|n",$sAutoyes) =~ /n/i) { die "Cannot apply configurations without 'import' folder, exiting...\n"; }
mkdir "$sUserConfDir";
}
chdir $sUserConfDir;
@ -270,21 +270,20 @@ sub ApplySetupConf { my ($rhConfig) = @_;
opendir(DIR, ".") or die $!;
my @aDirfile = grep { /\.txt/ && -f "$_" } readdir(DIR);
close DIR;
print "Current file in directory = [@aDirfile] target = [@aTargetfile] \n";
print "Current file in directory '@aDirfile' is target '@aTargetfile'.\n";
foreach my $sCurfile(@aTargetfile) {
print "Checking if target file: [$sCurfile] exist ? ";
print "Checking if target file '$sCurfile' exists... ";
if(-e -r $sCurfile) {
print "Yes\n";
print "$sCurfile seem to exist, overwritte it [y/n] ?\n";
print "Yes. Overwrite it? [y/n] \n";
if(GetValidAnwser("y|o|n",$sAutoyes) =~ /n/i) {
print "Only overwritte option supported atm skip file\n\n";
print "Only overwrite option currently supported. File skipped...\n\n";
next;
}
}
else { print "No\n" };
else { print "No.\n" };
print "\t Writting file $sCurfile \n";
print "\t Writing file '$sCurfile'...\n";
if($sCurfile eq MAP_CONF_FILE) { ApplyMapConf($rhConfig,$sCurfile); }
elsif($sCurfile eq CHAR_CONF_FILE) { ApplyCharConf($rhConfig,$sCurfile); }
elsif($sCurfile eq LOGIN_CONF_FILE) { ApplyLoginConf($rhConfig,$sCurfile); }
@ -293,7 +292,7 @@ sub ApplySetupConf { my ($rhConfig) = @_;
}
sub ApplyMapConf { my ($rhUserConf,$sCurfile) = @_;
open FILE, "> $sCurfile" || die "couldn't openfile/create $sCurfile \n";
open FILE, "> $sCurfile" || die "Couldn't open or create file '$sCurfile'.\n";
print FILE "userid: " . $$rhUserConf{SERV_UID}."\n";
print FILE "passwd: " . $$rhUserConf{SERV_PW}."\n\n";
@ -303,7 +302,7 @@ sub ApplyMapConf { my ($rhUserConf,$sCurfile) = @_;
}
sub ApplyCharConf { my ($rhUserConf,$sCurfile) = @_;
open FILE, "> $sCurfile" || die "couldn't openfile $sCurfile \n";
open FILE, "> $sCurfile" || die "Couldn't open file '$sCurfile'.\n";
print FILE "userid: " . $$rhUserConf{SERV_UID}."\n";
print FILE "passwd: " . $$rhUserConf{SERV_PW}."\n\n";
@ -313,13 +312,13 @@ sub ApplyCharConf { my ($rhUserConf,$sCurfile) = @_;
}
sub ApplyLoginConf { my ($rhUserConf,$sCurfile) = @_;
open FILE, "> $sCurfile" || die "couldn't openfile $sCurfile \n";
open FILE, "> $sCurfile" || die "Couldn't open file '$sCurfile'.\n";
print FILE "login_port: " . $$rhUserConf{LOGIN_PORT}."\n";
print FILE "use_MD5_passwords: " . $$rhUserConf{MD5_ENABLE}."\n";
}
sub ApplyInterConf { my ($rhUserConf,$sCurfile) = @_;
open FILE, "> $sCurfile" || die "couldn't openfile $sCurfile \n";
open FILE, "> $sCurfile" || die "Couldn't open file '$sCurfile'.\n";
print FILE "sql.db_hostname: " . $$rhUserConf{SQL_HOST}."\n";
print FILE "sql.db_port: " . $$rhUserConf{SQL_PORT}."\n";
@ -348,20 +347,21 @@ sub ApplyInterConf { my ($rhUserConf,$sCurfile) = @_;
}
sub AutoCheckConf { my ($rhConfig) = @_;
print "\n AutoCheckConf, \n you can use option --force=1 to bypass this \n";
print "\n== Auto-Check Configuration ==\n";
print "NOTE: You can use option --force=1 to bypass this.\n";
foreach my $sKeys (keys %$rhConfig){
my $sVal = $$rhConfig{$sKeys};
if($sKeys =~ /PORT/) { #chek if valid port
if(($sVal<MIN_PORT) && ($sVal>MAX_PORT)) {
warn "Invalid port specified for $sKeys => $sVal, must be in [".MIN_PORT.":".MAX_PORT."]\n";
warn "Invalid port specified for $sKeys => $sVal. Port must be in [".MIN_PORT.":".MAX_PORT."].\n";
return 0;
}
elsif(!($sKeys =~ /SQL/) && CheckUsedPort($sVal)) { #skip SQL service
warn "Port:$sVal seem to be already in use by system \n";
warn "Port '$sVal' seems to already be in use by your system.\n";
return 0;
}
elsif(CheckDupPort($rhConfig,$sKeys)) {
warn "Port:$sVal seem to be already used by other key in config \n";
warn "Port '$sVal' seems to already be used by another key in config.\n";
return 0;
}
}
@ -370,7 +370,8 @@ sub AutoCheckConf { my ($rhConfig) = @_;
my $sTest = $p->ping($sVal);
$p->close();
unless($sTest) {
print "Invalide IP/Host, ping couldn't reach $sKeys => $sVal \n NB : ICMP may just be unallowed\n";
print "Invalid IP/Host, ping couldn't reach $sKeys => $sVal.\n";
print "(NOTE: ICMP may just be unallowed.)\n";
return 0;
}
}
@ -403,13 +404,13 @@ sub ApplySetupDB { my($rhConfig) = @_;
$sDbH = CreateUser($sDbH,$rhConfig); #loged as user now
LoadSqlFile($sDbH,$rhConfig); #Load .sql file into db
CreateServUser($sDbH,$rhConfig);
print "SetupDb done \n";
print "Database setup successful.\n";
}
sub CreateDB { my($sDbH,$rhConfig) = @_;
print "\n Entering CreateDB \n";
print "\n== Creating Databases ==\n";
my $sDBn = $$rhConfig{SQL_MAIN_DB};
my $sLogDBn = $$rhConfig{SQL_LOG_DB};
my @aQuery = ("create database IF NOT EXISTS $sDBn;","create database IF NOT EXISTS $sLogDBn;");
@ -428,16 +429,16 @@ sub CreateDB { my($sDbH,$rhConfig) = @_;
}
sub ValidateDBMerge { my($sDBn) = @_;
warn "Database: '$sDBn' seem to already exist exiting\n";
warn "Continue will load data in existing db would you like to continue ? [y/n] \n";
warn "Database '$sDBn' seems to already exist.\n";
warn "Do you wish to continue loading data from the existing database? [y/n] \n";
if(GetValidAnwser("y|o|n",$sAutoyes) =~ /n/i) {
print "Exiting setup, please either setup with another dbname or manually\n";
print "Exiting setup, please try again with another dbname or manually...\n";
exit;
}
}
sub CreateUser { my($sDbH,$rhConfig) = @_;
print "\n Entering CreateUser \n";
print "\n== Creating User ==\n";
my $sDsn = $$rhConfig{"Dsn"};
print "My dsn = $sDsn \n";
my $sHost = $$rhConfig{SQL_HOST};
@ -451,12 +452,12 @@ sub CreateUser { my($sDbH,$rhConfig) = @_;
my $sUserDbh = DBI->connect($sDsn, $sUser, $sPw, {"PrintError" => 0}); #try connect with user
if($sUserDbh && !$sClean) {
print "User : $sUser seem to already exist, skipping creation\n"
."NB please check if you have correct privilege set for db: $sDBn \n";
print "User '$sUser' seems to already exist, skipping creation...\n"
."(Please check if you have correct privileges set for database '$sDBn'.)\n";
}
else { #create user only if not exist (or mode clean)
if($sClean && $sUser ne "root"){ unshift(@aQuery,"DELETE FROM mysql.user WHERE User = '$sUser';"); }
print "Creating user $sUser for dbs : $sDBn and $sLogDBn on $sHost \n";
print "Creating user $sUser for databases '$sDBn' and '$sLogDBn' on '$sHost'.\n";
ExeQuery($sDbH,@aQuery);
$sUserDbh = DBI->connect($sDsn, $sUser, $sPw);
}
@ -464,7 +465,7 @@ sub CreateUser { my($sDbH,$rhConfig) = @_;
}
sub LoadSqlFile { my($sDbH,$rhConfig) = @_;
print "\n Entering LoadSqlFile \n";
print "\n== Loading SQL Files ==\n";
my $sDBn = $$rhConfig{SQL_MAIN_DB};
my $sLogDBn = $$rhConfig{SQL_LOG_DB};
@ -472,9 +473,9 @@ sub LoadSqlFile { my($sDbH,$rhConfig) = @_;
my @aMainFiles = ("main.sql"); #add other file to load for main db here
my @aLogFiles = ("logs.sql"); #add other file to load for log db here
die "$sSqldir doesn't seem to exist or coudldn't be read" unless(-d -r "../$sSqldir");
die "$sSqldir doesn't seem to exist or couldn't be read." unless(-d -r "../$sSqldir");
chdir "../$sSqldir";
print "Checking if target files exist :\n\tMain: [@aMainFiles]\n\tLog: [@aLogFiles]\n";
print "Checking if target files exist:\n\tMain: [@aMainFiles]\n\tLog: [@aLogFiles]\n";
CheckAndLoadSQL(\@aMainFiles,$rhConfig,$sDBn);
CheckAndLoadSQL(\@aLogFiles,$rhConfig,$sLogDBn);
@ -490,7 +491,7 @@ sub LoadSqlFile { my($sDbH,$rhConfig) = @_;
# my @aQuery = ();
# foreach(@$raFiles) {
# unless(-f -r $_){
# print "File : $_ doesn't seem to exist or was unreadable skipped\n";
# print "File '$_' doesn't seem to exist or was unreadable, skipped...\n";
# next;
# }
# my $sFileFullPath = Cwd::abs_path($_);
@ -514,34 +515,32 @@ sub CreateServUser { my($sDbH,$rhConfig) = @_;
}
sub GetDesiredConf { my ($rhDefConf) = @_;
print "Please enter desired confiration\n";
print "Please enter desired configuration.\n";
my $rhUserConf;
my $sDesdConfFile = $sDsdFile;
#if default search in conf otherwise get specified name with cwd
if($sDsdFile eq DESD_CONF_FILE) { $sDesdConfFile = "../conf/".$sDsdFile; }
print "Checking if there an Desiredconf file \n";
print "Checking if there is a DesiredConf file...\n";
if(-e -r $sDesdConfFile) {
print "Found Desiredconf \n";
print "Found DesiredConf.\n";
$rhUserConf = YAML::XS::LoadFile($sDesdConfFile);
if(!($rhUserConf)){
print "Desiredconf seem invalid or empty, please check file and relaunch setup or entry Config\n";
print "DesiredConf is invalid or empty. Please check the file, and relaunch setup or enter Config.\n";
$rhUserConf=GetValidateConf($rhDefConf);
}
else {
ShowConfig($rhUserConf);
print "Would you like to apply those setting ? [y/n] ";
print "Would you like to apply these settings? [y/n] ";
if(GetValidAnwser("y|o|n",$sAutoyes) =~ /n/i) { #no take user entry
print "DesiredConf not applyed, please enter config\n";
print "DesiredConf not applied. Please enter config.\n";
$rhUserConf=GetValidateConf($rhDefConf);
}
}
}
else { #no files take user entry
print "No Desiredconf found, please enter config \n";
print "No DesiredConf found. Please enter config.\n";
$rhUserConf=GetValidateConf($rhDefConf);
}
return $rhUserConf;
}

View File

@ -1,4 +1,8 @@
#!/usr/bin/perl
# rAthena Item Type Converter
# Fixes incorrect weapon and armor item types.
# https://rathena.org/board/topic/90738-itemtype-update-read-this-very-important/
use strict;
use warnings;
use Getopt::Long;
@ -36,7 +40,7 @@ sub GetArgs {
@aFileout = split(",",$sFileouts);
}
unless(scalar(@aFileout)==scalar(@aFilein)){
print "ERROR: number of filein doesn't match number of fileout, you must speficy each fileout for each filein:\n"
print "ERROR: Number of input files doesn't match number of output files. You must specify an output for each input:\n"
."afilein = [ @aFilein ] \n"
."afileout = [ @aFileout ] \n";
exit;
@ -48,8 +52,8 @@ sub Main {
my($filename, $dir, $suffix) = fileparse($0);
chdir $dir; #put ourself like was called in tool folder
GetArgs();
print "Welcome to rA itemtype converter\n";
print "Were going to convert those files : @aFilein into @aFileout \n";
print "Running rAthena's item type converter...\n";
print "Files to be converted: '@aFilein' into '@aFileout'.\n";
foreach my $sFile (@aFilein){
my $sReplace=0; #should we replace file when finished
my $sFileouttmp=$aFileout[$sI];
@ -59,7 +63,7 @@ sub Main {
print "Asking to replace file tmp fileout= $sFileouttmp \n";
}
unless(open FHIN,"$sFile"){
print "Error, can't read or locate $sFile.\n";
print "ERROR: Can't read or locate $sFile.\n";
next;
}
unless(open FHOUT,">$sFileouttmp"){

View File

@ -17,9 +17,9 @@ sub GetValidateConf { my($rhConfig) = @_;
$rhUserConf = GetUserConf($rhConfig);
print "\n Please Check desired conf \n";
ShowConfig($rhUserConf);
print "Would you like to apply those setting ? [y/n] ";
print "Would you like to apply these settings? [y/n] ";
last if(GetValidAnwser("y|o|n") =~ /y|o/i);
print "\n Restarting configuration sequence \n";
print "\n Restarting configuration sequence...\n";
}
return $rhUserConf;
}
@ -52,7 +52,7 @@ sub GetValidAnwser { my($sOptReg,$sAutoyes) = @_;
else {
while(!($sAnwser =~ /$sOptReg/i)) {
$sAnwser = <>; chop($sAnwser);
print "Please enter a valid option : $sOptReg " unless($sAnwser =~ /$sOptReg/i);
print "Please enter a valid option: $sOptReg " unless($sAnwser =~ /$sOptReg/i);
}
}
return $sAnwser;
@ -66,7 +66,7 @@ sub CheckUsedPort { my($sPort) = @_;
sub RootCo { my($rhConfig) = @_;
print "\n Entering RootCo \n";
print "\n== Entering RootCo ==\n";
my $sDbH = 0;
my $sDsn = $$rhConfig{"Dsn"}; #mysql server dest
my $sUser = $$rhConfig{SQL_UID}; #verify desired user
@ -74,10 +74,10 @@ sub RootCo { my($rhConfig) = @_;
if($sUser eq "root"){
my $sPw = $$rhConfig{SQL_PW};
$sDbH = DBI->connect($sDsn, "root", $sPw);
unless($sDbH) { warn "Your root password doesn't seem valid for mysql, your desired-conf is wrong \n"; }
unless($sDbH) { warn "Your root password doesn't seem valid for mysql. Please check your desired-conf.\n"; }
}
while($sDbH == 0) { #if can't use user to connect user root
print "Please inser DB root passeword (this won't be saved in any configuration file, needed to create dbs and user)\n";
print "Please enter database root password. (NOTE: This is needed to create the users and databases, and will not be saved in any configuration file.)\n";
my $sRPw = <>; chop($sRPw);
$sDbH = DBI->connect($sDsn, "root", $sRPw);
}
@ -92,7 +92,7 @@ sub CheckAndLoadSQL { my ($raFiles,$rhConfig,$sDBn) = @_;
foreach(@$raFiles) {
unless(-f -r $_){
print "File : $_ doesn't seem to exist or was unreadable skipped\n";
print "File '$_' does not exist or could not be read, skipped...\n";
next;
}
my $sFileFullPath = Cwd::abs_path($_);
@ -102,8 +102,8 @@ sub CheckAndLoadSQL { my ($raFiles,$rhConfig,$sDBn) = @_;
sub ExeQuery { my $sDbH = shift;
my @aQuery = @_;
print "my querys are = [ @aQuery ]\n";
print "Queries: [ @aQuery ]\n";
foreach(@aQuery) {
unless($sDbH->do($_)){ print "Failed to execute query : $_ => $DBI::errstr \n"; }
unless($sDbH->do($_)){ print "Failed to execute query: $_ => $DBI::errstr \n"; }
}
}

View File

@ -1,3 +1,4 @@
#!/bin/sh
#simple script to setupperl environnement with all module dependancy needed
# Perl Setup
# Sets up perl environment with all required module dependencies.
cpan install File::Basename Getopt::Long DBI DBD::mysql YAML YAML:XS Cwd Net::Ping Scalar::Util Git::Repository;

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl
# upgrading rA emulator, (src,npc,db..).
# perform sql db update
# perform binary recompilation
# rAthena Updater
# Performs git update, applies SQL database changes, and recompiles binaries.
use strict;
use Getopt::Long;
@ -49,19 +48,19 @@ Main();
sub GetArgs {
GetOptions(
'target=s' => \$sTarget, #Target (wich setup to run)=
'target=s' => \$sTarget, #Target (which setup to run)
'help!' => \$sHelp,
) or $sHelp=1; #display help if invalid option
) or $sHelp=1; #display help if invalid option
if( $sHelp ) {
print "Incorect option specified, available option are:\n"
."\t --target => target (specify wich check to ignore [$sValidTarget])\n";
print "Incorrect option specified. Available options:\n"
."\t --target => target (specify which check to ignore [$sValidTarget])\n";
exit;
}
if(!$sTarget || !($sTarget =~ /$sValidTarget/i)){
print "Incorect target specified, available target are:\n"
."\t --target => target (specify wich check to ignore [(default)$sValidTarget])\n
NB restart is compiling dependant\n";
print "Incorrect target specified. Available targets:\n"
."\t --target => target (specify which check to ignore [(default)$sValidTarget])\n
(NOTE: restart is compiling dependent.)\n";
exit;
}
}
@ -94,15 +93,15 @@ sub UpdateSQL { my($sBaseDir,$sInit,$rhFileState) = @_;
my @aLoginDBFiles = ();
my @aLogDBFiles = ();
print "Preparing SQL folder\n" if($sInit==1);
print "Preparing SQL folder...\n" if($sInit==1);
if(-e -r "sql-files/".STATE_FILE) {
print "Reading file status \n";
print "Reading file status...\n";
$rhFileState = YAML::XS::LoadFile("sql-files/".STATE_FILE);
}
if($sTarget =~ "All|MapDB") {
chdir "sql-files";
print "Getting Map SQL Db file \n";
print "Getting Map SQL Db file...\n";
my $raFilesMap = GetSqlFileInDir("./");
foreach my $sFile (@$raFilesMap){
if($sInit==1){
@ -147,11 +146,11 @@ sub UpdateSQL { my($sBaseDir,$sInit,$rhFileState) = @_;
}
if( $sFile =~ /_log.sql$/) {
print "Found log file = $sFile \n";
print "Found log file '$sFile'.\n";
push(@aLogDBFiles,$sFile);
}
else {
print "Found char file = $sFile \n";\
print "Found char file '$sFile'.\n";
push(@aCharDBFiles,$sFile);
}
$$rhFileState{$sFile}{"status"} = "done"; # the query will be applied so mark it so
@ -182,18 +181,18 @@ sub UpdateSQL { my($sBaseDir,$sInit,$rhFileState) = @_;
if( scalar(@aCharDBFiles)==0 and scalar(@aLogDBFiles)==0
and scalar(@aMapDBFiles)==0 and scalar(@aLoginDBFiles)==0
){
print "No SQL Update to perform\n";
print "No SQL update to perform.\n";
}
else {
print "Updating DB \n";
my $rhUserConf;
if($sAutoDB==0){
$rhUserConf=GetValidateConf(\%hDefConf);
print "To make this step auto you can edit hDefConf and set sAutoDB to 1.
both parameter at the begining of file for the moment\n";
print "To make this step automatic you can edit hDefConf and set sAutoDB to 1.
Both parameters are at the begining of the file for the moment.\n";
}
else {
$rhUserConf=\%hDefConf; #we assum it's set correctly
$rhUserConf=\%hDefConf; #we assume it's set correctly
}
CheckAndLoadSQL(\@aMapDBFiles,$rhUserConf,$$rhUserConf{SQL_MAP_DB});
@ -204,7 +203,7 @@ sub UpdateSQL { my($sBaseDir,$sInit,$rhFileState) = @_;
chdir "../..";
} else {
chdir "../..";
print "Saving stateFile \n";
print "Saving stateFile...\n";
YAML::XS::DumpFile("sql-files/".STATE_FILE,$rhFileState);
}
@ -212,15 +211,15 @@ sub UpdateSQL { my($sBaseDir,$sInit,$rhFileState) = @_;
sub RunCompilation { my($sBaseDir,$sTarget) = @_;
if($^O =~ "linux"){
print "Recompiling \n";
print "Recompiling...\n";
system('./configure && make clean server');
if($sTarget =~ "All|Restart") {
print "Restarting \n";
print "Restarting...\n";
system('./athena-start restart');
}
}
else {
print "AutoCompilation ain't supported for this OS yet (OS detected=$^O \n";
print "Automatic compilation is not yet supported for this OS ($^O detected).\n";
}
}
@ -231,19 +230,19 @@ sub GitUpdate { my($sBaseDir) = @_;
my $sIsOrigin = CheckRemote($sGit);
if($sIsOrigin==0){
print "Saving current work\n";
print "Saving current working tree...\n";
$sGit->run( "stash" );
print "Fetching new content and merging\n";
print "Fetching and merging new content...\n";
$sGit->run( "pull" );
print "Attempt applying save work\n";
print "Attempting to re-apply user changes...\n";
$sGit->run( "stash" => "pop" );
}
else { #it's a fork
print "Fetching upstream\n";
print "Fetching 'upstream'...\n";
$sGit->run( "fetch" => "upstream" );
print "Switching to master branch\n";
print "Switching to branch 'master'...\n";
$sGit->run( "checkout" => "master" );
print "Merging upstream with master\n";
print "Merging 'upstream' with 'master'...\n";
$sGit->run( "merge" => "upstream/master" );
}
}