initial commit of file from CVS for smeserver-support on Mon 10 Jul 08:43:33 BST 2023

This commit is contained in:
Brian Read
2023-07-10 08:43:33 +01:00
parent f3dcd239bb
commit 56eab664a2
40 changed files with 2032 additions and 2 deletions

View File

@@ -0,0 +1,44 @@
package esmith::console::support;
use strict;
use warnings;
use esmith::console;
use Locale::gettext;
sub new
{
my $class = shift;
my $self = {
name => gettext('View support and licensing information'),
order => 60,
};
bless $self, $class;
return $self;
}
sub name
{
return $_[0]->{name};
}
sub order
{
return $_[0]->{order};
}
sub doit
{
#------------------------------------------------------------
# SUPPORT:
#------------------------------------------------------------
my ($self, $console, $db) = @_;
my $licenseFile = esmith::util::getLicenseFile();
my ($rc, $choice) = $console->textbox
(
title => gettext('Support and licensing information'),
file => $licenseFile,
);
return;
}
return esmith::console::support->new;

View File

@@ -0,0 +1,77 @@
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;

View File

@@ -0,0 +1,66 @@
#!/usr/bin/perl
#----------------------------------------------------------------------
# statusreport
# copyright (C) 1999-2006 Mitel Corporation
# Copyright (C) 2006 Gordon Rowell <gordonr@gormand.com.au>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License or more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#----------------------------------------------------------------------
use strict;
use warnings;
use Locale::gettext;
use LWP;
use LWP::Protocol::https;
use HTTP::Request::Common;
use Digest::SHA1 qw(sha1_hex);
use esmith::ConfigDB;
my $db = esmith::ConfigDB->open_ro or die "Couldn't open ConfigDB\n";
use constant SERVERTEST => 'https://www.koozali.org/servertest/';
my $sysid_hash = sha1_hex($db->get_prop('sysconfig','SystemID'));
my $url = SERVERTEST
. "?"
. "ReleaseVersion=" . $db->get_prop('sysconfig', 'ReleaseVersion')
. "&SystemIDHash=" . $sysid_hash
. "&CurrentEpoch=" . time
. "&InstallEpoch=" . $db->get_prop('sysconfig', 'InstallEpoch')
. "&SystemMode=" . $db->get_value('SystemMode');
my $ua = LWP::UserAgent->new;
#return add proxy arguments if appropriate
if ($db->get_value('SquidParent'))
{
my $parent = $db->get_value('SquidParent');
my $port = $db->get_value('SquidParentPort') || "3128";
$ua->proxy(['http', 'ftp'], "http://$parent:$port/");
}
my $response;
eval {
local $SIG{INT} = sub {die 1};
$response = $ua->get($url);
};
exit 0 if ($response->is_success);
exit 1;