mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
db_update.pl self update routine
Some linux adjustments
This commit is contained in:
parent
c465b8c8c3
commit
98c21635c2
@ -6,6 +6,21 @@
|
|||||||
#::: Purpose: To upgrade databases with ease and maintain versioning
|
#::: Purpose: To upgrade databases with ease and maintain versioning
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
|
|
||||||
|
#::: If current version is less than what world is reporting, then download a new one...
|
||||||
|
$current_version = 1;
|
||||||
|
if($ARGV[0] eq "V"){
|
||||||
|
if($ARGV[1] > $current_version){
|
||||||
|
print "Retrieving latest database manifest...\n";
|
||||||
|
GetRemoteFile("https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/db_update.pl", "db_update.pl");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print "No update necessary \n";
|
||||||
|
}
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
$perl_version = $^V;
|
$perl_version = $^V;
|
||||||
$perl_version =~s/v//g;
|
$perl_version =~s/v//g;
|
||||||
print "Perl Version is " . $perl_version . "\n";
|
print "Perl Version is " . $perl_version . "\n";
|
||||||
@ -26,14 +41,14 @@ while(<F>) {
|
|||||||
elsif(/<db>(.*)<\/db>/i) { $db = $1; }
|
elsif(/<db>(.*)<\/db>/i) { $db = $1; }
|
||||||
}
|
}
|
||||||
|
|
||||||
print
|
$console_output =
|
||||||
"============================================================
|
"============================================================
|
||||||
EQEmu: Automatic Database Upgrade Check
|
EQEmu: Automatic Database Upgrade Check
|
||||||
============================================================
|
============================================================
|
||||||
";
|
";
|
||||||
|
|
||||||
use Config;
|
use Config;
|
||||||
print " Operating System is: $Config{osname}\n";
|
$console_output .= " Operating System is: $Config{osname}\n";
|
||||||
if($Config{osname}=~/linux/i){ $OS = "Linux"; }
|
if($Config{osname}=~/linux/i){ $OS = "Linux"; }
|
||||||
if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; }
|
if($Config{osname}=~/Win|MS/i){ $OS = "Windows"; }
|
||||||
|
|
||||||
@ -48,9 +63,9 @@ if($OS eq "Windows"){
|
|||||||
last;
|
last;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
print " (Windows) MySQL is in system path \n";
|
$console_output .= " (Windows) MySQL is in system path \n";
|
||||||
print " Path = " . $path . "\n";
|
$console_output .= " Path = " . $path . "\n";
|
||||||
print "============================================================\n";
|
$console_output .= "============================================================\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,9 +77,9 @@ if($OS eq "Linux"){
|
|||||||
}
|
}
|
||||||
$path =~s/\n//g;
|
$path =~s/\n//g;
|
||||||
|
|
||||||
print " (Linux) MySQL is in system path \n";
|
$console_output .= " (Linux) MySQL is in system path \n";
|
||||||
print " Path = " . $path . "\n";
|
$console_output .= " Path = " . $path . "\n";
|
||||||
print "============================================================\n";
|
$console_output .= "============================================================\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
#::: Path not found, error and exit
|
#::: Path not found, error and exit
|
||||||
@ -93,10 +108,21 @@ if(GetMySQLResult("SHOW TABLES LIKE 'db_version'") eq ""){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($OS eq "Windows"){ @db_version = split(': ', `world db_version`); }
|
if($OS eq "Windows"){ @db_version = split(': ', `world db_version`); }
|
||||||
if($OS eq "Linux"){ @db_version = split(': ', `./world db_version`); }
|
if($OS eq "Linux"){ @db_version = split(': ', `./world db_version`); }
|
||||||
|
|
||||||
$bin_db_ver = trim($db_version[1]);
|
$bin_db_ver = trim($db_version[1]);
|
||||||
$local_db_ver = trim(GetMySQLResult("SELECT version FROM db_version LIMIT 1"));
|
$local_db_ver = trim(GetMySQLResult("SELECT version FROM db_version LIMIT 1"));
|
||||||
|
|
||||||
|
#::: If ran from Linux startup script, supress output
|
||||||
|
if($bin_db_ver == $local_db_ver && $ARGV[0] eq "ran_from_start"){
|
||||||
|
print "Database up to date...\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print $console_output;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
print " Binary Database Version: (" . $bin_db_ver . ")\n";
|
print " Binary Database Version: (" . $bin_db_ver . ")\n";
|
||||||
print " Local Database Version: (" . $local_db_ver . ")\n\n";
|
print " Local Database Version: (" . $local_db_ver . ")\n\n";
|
||||||
|
|
||||||
@ -135,7 +161,7 @@ sub ShowMenuPrompt {
|
|||||||
while (1) {
|
while (1) {
|
||||||
{
|
{
|
||||||
local $| = 1;
|
local $| = 1;
|
||||||
if(!$menu_show && $ARGV[0] eq "ran_from_world"){
|
if(!$menu_show && ($ARGV[0] eq "ran_from_world" || $ARGV[0] eq "ran_from_start")){
|
||||||
$menu_show++;
|
$menu_show++;
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user