summaryrefslogtreecommitdiffstats
path: root/mdkonline
diff options
context:
space:
mode:
Diffstat (limited to 'mdkonline')
-rwxr-xr-xmdkonline53
1 files changed, 41 insertions, 12 deletions
diff --git a/mdkonline b/mdkonline
index 6db3910d..83809fcd 100755
--- a/mdkonline
+++ b/mdkonline
@@ -30,6 +30,9 @@ Gtk->set_locale;
#use strict;
use MDK::Common;
use Digest::MD5 qw(md5 md5_hex md5_base64);
+use HTTP::Request;
+use HTTP::Request::Common;
+use LWP::UserAgent;
my $in = 'interactive'->vnew('su', 'default');
@@ -108,7 +111,8 @@ my $passwd = "";
my %actions = (
2 => \&test_passwd,
- 3 => \&send_config
+ 3 => \&send_config,
+ 4 => \&send_config
);
my @no_back_button_pages = (0,3,4,5);
@@ -221,9 +225,8 @@ sub test_passwd () {
# first, MD5ify the password
$passwd = md5 ($passwd); # or md5_hex () or md5_base64 ()
- require HTTP::Request;
- require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
+ $ua->agent("MdkOnlineAgent/0.15" . $ua->agent);
# TEST URL
print STDERR "Real url should be: $authentication_host?u=$login&p=$passwd \n";
my $request = HTTP::Request->new(GET => 'http://www.mandrakeexpert.com/firsttimewizard/validusercheck.php?u=mark&p=26bdb06eabafac3aea95991149dd8ea9');
@@ -234,7 +237,7 @@ sub test_passwd () {
if ($response->is_success) {
$result = ($response->content =~ /TRUE/) ? 0 : -1;
} else {
- # pb with the connection ?
+ # pb with the connection ? stay on page 2
info_popup (_("Connection problem"), _("MandrakeOnline could not be contacted, please try again at a later time"));
return;
}
@@ -256,20 +259,46 @@ sub test_passwd () {
sub send_config {
# When we arrive here, we're sure the login/passwd is correct
# print STDERR "Sending config\n";
+ my $result = -1;
`/usr/sbin/drakbug_report > /root/$login-drakbug_report.log`;
- `/usr/bin/bzip2 \\\-9 /root/$login-drakbug_report.log`;
+# `/usr/bin/bzip2 \\\-9 \\\-f /root/$login-drakbug_report.log`;
- my $scp_script = "";
- foreach ("/usr/bin/scpcall.exp","./scpcall.exp") {
- [ -e "$_" ] and $scp_script="$_", last;
- }
+# OLD METHOD (scp)
+# my $scp_script = "";
+# foreach ("/usr/bin/scpcall.exp","./scpcall.exp") {
+# [ -e "$_" ] and $scp_script="$_", last;
+# }
# print "Exec: $scp_script /root/drakbug_report.log $login $authentication_host $passwd \n";
# TODO: beware if the script was not found
- `$scp_script /root/drakbug_report.log $login $authentication_host $passwd`;
+# `$scp_script /root/drakbug_report.log $login $authentication_host $passwd`;
+
+# NEW METHOD (http)
+ my $ua = LWP::UserAgent->new;
+ $ua->agent("MdkOnlineAgent/0.15" . $ua->agent);
+ my $response = $ua->request(POST 'http://devweb.mandrakesoft.com/online/dev/test/test-up-wizard.php',
+ Content_Type => 'form-data',
+ Content => [name => "mark",
+ submit => "test_upload",
+ wizard => ["/root/$login-drakbug_report.log",
+ "test_upload_file"
+ ]
+ ]);
+# undef,
+# Content_Type => 'application/x-bzip2
+
+ # Check the outcome of the response
+ print "REPONSE: ".$response->content."\n";
+ if ($response->is_success) {
+ $result = 0;
+ } else {
+ # pb with the connection ?
+ info_popup (_("Connection problem"), _("MandrakeOnline could not be contacted, please try again at a later time"));
+ $result = -1;
+ }
# if informations were sent correctly (exit code: 0 from scp script), go to page 5
- if (! $?) {
+ if (! $result) {
$notebook_global->set_page(5);
} else {
# if incorrect, go/stay on page 4 to retry sending data
@@ -321,7 +350,7 @@ sub step_wizard {
# building the "Error sending data" page
my $vbox_errorsend= new Gtk::VBox(0,0);
write_on_pixmaps($vbox_errorsend,"identity.png",_("Error while sending informations"),540,100);
- my $label_errorsend = new Gtk::Label("\n\n" . _("There was an error while sending your personal informations"));
+ my $label_errorsend = new Gtk::Label("\n\n" . _("There was an error while sending your personal informations.\n\nPress Next to try and send your configuration again."));
$vbox_errorsend->pack_start($label_errorsend,$false ,$false,1);
$notebook_global->append_page($vbox_errorsend,new Gtk::Label("errorsend"));