smeserver-support/root/sbin/e-smith/console-menu-items/testInternet.pl

78 lines
2.8 KiB
Perl
Raw Normal View History

package esmith::console::testInternetAccess;
use esmith::console;
use Locale::gettext;
sub new
{
my $class = shift;
my $self = {
name => gettext("Test Internet access"),
order => 30,
};
bless $self, $class;
return $self;
}
sub name
{
return $_[0]->{name};
}
sub order
{
return $_[0]->{order};
}
sub doit
{
my $console = new esmith::console;
($rc, $choice) = $console->yesno_page
(
title => gettext("Test Internet access"),
text =>
gettext("After your Internet connection is operational and your server has been connected and configured, this test will verify that your server can communicate with the Internet.") .
"\n\n" .
gettext("As part of this test, two pieces of information will be sent to koozali.org - the version installed on your server and a string used to differentiate your server from others using this test. This string is generated by a one-way hash function and access to the string does not provide any information about your server.") .
"\n\n" .
gettext("We appreciate your assistance in sending this information so we can gain an accurate count of the installed servers.") .
"\n\n" .
gettext("Do you wish to run the test?"),
);
return unless ($rc == 0);
print '-' x 75 . "\n";
print gettext("Attempting to test Internet connection.") . "\n";
print gettext("If this test takes too long, please halt it by typing Ctrl-C.") . "\n";
print '-' x 75 . "\n";
if (system("/sbin/e-smith/statusreport") == 0)
{
($rc, $choice) = $console->message_page
(
title => gettext("Internet connection successful"),
text =>
gettext("The test was successful! Your server was able to communicate with koozali.org."),
);
}
else
{
($rc, $choice) = $console->message_page
(
title => gettext("Internet connection failed"),
text =>
gettext("The test failed. Your server was unable to establish contact with koozali.org via the Internet.") .
"\n\n" .
gettext("Please check that your server is correctly configured. A reboot may be required if certain settings are modified and the configuration process will advise you if this is required.") .
"\n\n" .
gettext("You might also want to check with your Internet provider to make sure that your Internet connection is working properly.") .
"\n\n" .
gettext("It is also possible (although unlikely) that there is a technical problem at the koozali.org site. In this case, you should proceed with your installation and run this test again later."),
);
}
}
new esmith::console::testInternetAccess;