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

@ -241,45 +241,43 @@ if($ARGV[0] eq "login_server_setup"){
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 $remote_script_size = -s "updates_staged/eqemu_server.pl";
my $local_script_size = -s "eqemu_server.pl"; my $local_script_size = -s "eqemu_server.pl";
if($remote_script_size != $local_script_size){ if($remote_script_size != $local_script_size){
print "[Update] Script has been updated, updating...\n"; print "[Update] Script has been updated, updating...\n";
my @files; my @files;
my $start_dir = "updates_staged/"; my $start_dir = "updates_staged/";
find( find(
sub { push @files, $File::Find::name unless -d; }, sub { push @files, $File::Find::name unless -d; },
$start_dir $start_dir
); );
for my $file (@files) { for my $file (@files) {
if($file=~/eqemu_server/i){ if($file=~/eqemu_server/i){
$destination_file = $file; $destination_file = $file;
$destination_file =~s/updates_staged\///g; $destination_file =~s/updates_staged\///g;
print "[Install] Installing :: " . $destination_file . "\n"; print "[Install] Installing :: " . $destination_file . "\n";
unlink($destination_file); unlink($destination_file);
copy_file($file, $destination_file); copy_file($file, $destination_file);
if($OS eq "Linux"){ if($OS eq "Linux"){
system("chmod 755 eqemu_server.pl"); system("chmod 755 eqemu_server.pl");
system("chown eqemu eqemu_server.pl"); system("chown eqemu eqemu_server.pl");
system("perl 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");
} }
} }