Warn about wrong version starting at boot

This commit is contained in:
Jamie Cameron
2020-06-28 17:02:23 -07:00
parent f35a49bac8
commit 0bf0974ed7
2 changed files with 15 additions and 1 deletions

View File

@@ -4,7 +4,8 @@
use strict;
use warnings;
require './minecraft-lib.pl';
our (%in, %text, %config, $module_name, $module_root_directory);
our (%in, %text, %config, $module_name, $module_root_directory,
$module_config_directory);
&ui_print_header(undef, $text{'index_title'}, "", undef, 1, 1, 0,
&help_search_link("minecraft", "google"));
@@ -109,5 +110,17 @@ print &ui_buttons_row("atboot.cgi",
print &ui_buttons_end();
# Check if enabled at boot, but with wrong command
if ($starting == 2) {
my $startscript = "$module_config_directory/start.sh";
my $startcode = &read_file_contents($startscript);
my $startcmd = &get_start_command();
my $qstartcmd = quotemeta($startcmd);
if ($startcode !~ /\Q$startcmd\E/ &&
$startcode !~ /\Q$qstartcmd\E/) {
print "<font color=red><b>$text{'index_startwarn'}</b></font><p>\n";
}
}
&ui_print_footer("/", $text{'index'});

View File

@@ -20,6 +20,7 @@ index_download=Download Server
index_downloaddesc=Click this button to download and install the latest version of the Minecraft server JAR file.
index_upgradedesc=A new Minecraft server version is now available for download.
index_upgrade=Upgrade Now
index_startwarn=WARNING! A different version of Minecraft may be configured to start at boot time.
check_edir=The base directory $1 does not exist
check_ejar=The server JAR file $1 does not exist