eqemu_server.pl - Update regardless of run condition [skip ci]

This commit is contained in:
Akkadius 2016-08-25 16:39:35 -05:00
parent d5864aea3e
commit f7cc1053f1

View File

@ -237,49 +237,47 @@ if($ARGV[0] eq "db_dump_compress"){ database_dump_compress(); exit; }
if($ARGV[0] eq "login_server_setup"){ if($ARGV[0] eq "login_server_setup"){
do_windows_login_server_setup(); do_windows_login_server_setup();
exit; exit;
} }
sub do_self_update_check_routine { sub do_self_update_check_routine {
#::: Check Version passed from world to update script #::: Check Version passed from world to update script
if($ARGV[0] eq "ran_from_world") { get_remote_file($eqemu_repository_request_url . "utils/scripts/eqemu_server.pl", "updates_staged/eqemu_server.pl", 0, 1);
get_remote_file($eqemu_repository_request_url . "utils/scripts/eqemu_server.pl", "updates_staged/eqemu_server.pl", 0, 1);
if(-e "updates_staged/eqemu_server.pl") {
if(-e "updates_staged/eqemu_server.pl") { my $remote_script_size = -s "updates_staged/eqemu_server.pl";
my $local_script_size = -s "eqemu_server.pl";
my $remote_script_size = -s "updates_staged/eqemu_server.pl";
my $local_script_size = -s "eqemu_server.pl"; if($remote_script_size != $local_script_size){
print "[Update] Script has been updated, updating...\n";
if($remote_script_size != $local_script_size){
print "[Update] Script has been updated, updating...\n"; my @files;
my $start_dir = "updates_staged/";
my @files; find(
my $start_dir = "updates_staged/"; sub { push @files, $File::Find::name unless -d; },
find( $start_dir
sub { push @files, $File::Find::name unless -d; }, );
$start_dir for my $file (@files) {
); if($file=~/eqemu_server/i){
for my $file (@files) { $destination_file = $file;
if($file=~/eqemu_server/i){ $destination_file =~s/updates_staged\///g;
$destination_file = $file; print "[Install] Installing :: " . $destination_file . "\n";
$destination_file =~s/updates_staged\///g; unlink($destination_file);
print "[Install] Installing :: " . $destination_file . "\n"; copy_file($file, $destination_file);
unlink($destination_file); if($OS eq "Linux"){
copy_file($file, $destination_file); system("chmod 755 eqemu_server.pl");
if($OS eq "Linux"){ system("chown eqemu eqemu_server.pl");
system("chmod 755 eqemu_server.pl"); system("perl eqemu_server.pl");
system("chown eqemu eqemu_server.pl");
system("perl eqemu_server.pl");
}
} }
} }
print "[Install] Done\n";
} }
else { print "[Install] Done\n";
print "[Update] No script update necessary...\n";
}
unlink("updates_staged/eqemu_server.pl");
} }
else {
print "[Update] No script update necessary...\n";
}
unlink("updates_staged/eqemu_server.pl");
} }
} }