summaryrefslogtreecommitdiffstats
path: root/mdkonline
diff options
context:
space:
mode:
authorDaouda Lo <daouda@mandriva.com>2006-02-15 15:32:03 +0000
committerDaouda Lo <daouda@mandriva.com>2006-02-15 15:32:03 +0000
commit4fffbb41ed2a54edd3cc5df0ff3ce7285f3242dd (patch)
treeec161eb2e219914226e19af82ca75b71423cc53f /mdkonline
parentca96c9ccd3a85cf3a5053639d7975811a270120e (diff)
downloadmgaonline-4fffbb41ed2a54edd3cc5df0ff3ce7285f3242dd.tar
mgaonline-4fffbb41ed2a54edd3cc5df0ff3ce7285f3242dd.tar.gz
mgaonline-4fffbb41ed2a54edd3cc5df0ff3ce7285f3242dd.tar.bz2
mgaonline-4fffbb41ed2a54edd3cc5df0ff3ce7285f3242dd.tar.xz
mgaonline-4fffbb41ed2a54edd3cc5df0ff3ce7285f3242dd.zip
- fixed wizard mode
Diffstat (limited to 'mdkonline')
-rwxr-xr-xmdkonline224
1 files changed, 113 insertions, 111 deletions
diff --git a/mdkonline b/mdkonline
index f3b97409..7a2e17dc 100755
--- a/mdkonline
+++ b/mdkonline
@@ -2,7 +2,8 @@
################################################################################
# Mandriva Online Text User Interface #
# #
-# Copyright (C) 2001-2005 Mandriva #
+# Copyright (C) 2001, 2002, 2003, 2004, Mandrakesoft SA
+# 2005 Mandriva #
# #
# Daouda Lo <daouda at mandriva dot com> #
#
@@ -95,128 +96,129 @@ sub send_conf {
($sendconfres, $key);
}
-$wiz = {
- name => N("Mandriva Online"),
- pages => {
- welcome => {
- name => N("This assistant will help you to upload your configuration\n(packages, hardware configuration) to a centralized database in\norder to keep you informed about security updates and useful upgrades.\n"),
- no_back => 1,
- next => 'choices'
- },
- choices => {
- name => N("Account creation or authentication"),
- data => [ { val => \$choice, type => 'list', list => [ values %choices ] } ],
- post => sub { +{ reverse %choices }->{$choice} },
- },
- account => {
- name => N("Enter your Mandriva Online login, password and machine name:"),
- pre => sub {
- read_conf();
- },
+my $wiz = wizards->new(
+ {
+ name => N("Mandriva Online"),
+ pages => {
+ welcome => {
+ name => N("This assistant will help you to upload your configuration\n(packages, hardware configuration) to a centralized database in\norder to keep you informed about security updates and useful upgrades.\n"),
+ no_back => 1,
+ next => 'choices'
+ },
+ choices => {
+ name => N("Account creation or authentication"),
+ data => [ { val => \$choice, type => 'list', list => [ values %choices ] } ],
+ post => sub { +{ reverse %choices }->{$choice} },
+ },
+ account => {
+ name => N("Enter your Mandriva Online login, password and machine name:"),
+ pre => sub {
+ read_conf();
+ },
+ data => sub {
+ [
+ { label => N("Email address:"), val => \$login },
+ { label => N("Password:"), val => \$password, hidden => 1 },
+ { label => N("Machine name:"), val => \$boxname },
+ ];
+ },
+ post => sub {
+ if (!mdkonline::check_valid_boxname($boxname)) {
+ $is_success = N("Machine name must be 1 to 40 alphanumerical characters");
+ } else {
+ my $_wait = $in->wait_message(N("Please wait"), N("Connecting to Mandriva Online website...")) if $ia;
+ @info = ($login, $password);
+ $is_success = mdkonline::create_authenticate_account('authenticate', @info); undef($_wait);
+ }
+ "authenticate";
+ },
+ },
+ authenticate => {
+ name => sub {
+ if ($is_success eq 'OK') {
+ N("In order to benefit from Mandriva Online services,\nwe are about to upload your configuration.\n\nThe Wizard will now send the following information to Mandriva:\n1) the list of packages you have installed on your system,\n2) your hardware configuration.\n\nIf you feel uncomfortable by that idea, or do not want to benefit from this service,\nplease press 'Cancel'. By pressing 'Next', you allow us to keep you informed\nabout security updates and useful upgrades via personalized email alerts.\nFurthermore, you benefit from discounted paid support services on\nwww.mandrivaexpert.com.");
+ } else {
+ $is_success
+ }
+ },
+ no_back => $is_success eq 'OK' ? 1 : 0,
+ post => sub {
+ if ($is_success eq 'OK') {
+ ($sendconfres, $key) = send_conf($login, $password, $boxname);
+ "upload";
+ } else { "choices" }
+ }
+ },
+ noaccount => {
+ name => N("Create a Mandriva Online Account"),
data => sub {
[
- { label => N("Email address:"), val => \$login },
- { label => N("Password:"), val => \$password, hidden => 1 },
- { label => N("Machine name:"), val => \$boxname },
+ { label => N("Greeting:"), val => \$greeting, list => [ @greets ], type => 'combo'},
+ { label => N("First name:"), val => \$firstname },
+ { label => N("Last name:"), val => \$lastname },
+ { label => N("Email address:"), val => \$account },
+ { label => N("Password:"), val => \$npassword, hidden => 1 },
+ { label => N("Confirm Password:"), val => \$cfmpassword, hidden => 1 },
];
},
post => sub {
- if (!mdkonline::check_valid_boxname($boxname)) {
- $is_success = N("Machine name must be 1 to 40 alphanumerical characters");
- } else {
- my $_wait = $in->wait_message(N("Please wait"), N("Connecting to Mandriva Online website...")) if $ia;
- @info = ($login, $password);
- $is_success = mdkonline::create_authenticate_account('authenticate', @info); undef($_wait);
- }
- "authenticate";
- },
+ $gr = find_index { /$gr/ } @greets;
+ $alias = $firstname . $lastname;
+ @info = ($account, $npassword, $firstname, $lastname, $lang, $greeting, $alias, 'home');
+ $createaccount = $npassword ne $cfmpassword ? N("The passwords do not match\n Please try again\n") : (!$account || !$firstname || !$lastname) ? N("Please fill in each field") : mdkonline::check_valid_email($email) == 0 ? N("Not a valid mail address!\n") : mdkonline::create_authenticate_account('create', @info);
+ "createaccount";
+ }
},
- authenticate => {
- name => sub {
- if ($is_success eq 'OK') {
- N("In order to benefit from Mandriva Online services,\nwe are about to upload your configuration.\n\nThe Wizard will now send the following information to Mandriva:\n1) the list of packages you have installed on your system,\n2) your hardware configuration.\n\nIf you feel uncomfortable by that idea, or do not want to benefit from this service,\nplease press 'Cancel'. By pressing 'Next', you allow us to keep you informed\nabout security updates and useful upgrades via personalized email alerts.\nFurthermore, you benefit from discounted paid support services on\nwww.mandrivaexpert.com.");
- } else {
- $is_success
-# N("Connection problem") . " " . N("or") . " " . N("wrong password:") . "\n" . N("Your login or password was wrong.\n Either you'll have to type it again, or you'll need to create an account on Mandriva Online.\n In the latter case, go back to the first step to connect to Mandriva Online.\n Be aware that you must also provide a Machine name \n (only alphabetical characters are admitted)");
- }
- },
- no_back => $is_success eq 'OK' ? 1 : 0,
- post => sub {
- if ($is_success eq 'OK') {
- ($sendconfres, $key) = send_conf($login, $password, $boxname);
- "upload";
- } else { "choices" }
- }
+ createaccount => {
+ name => sub {
+ $createaccount eq 'OK' ? "\n\n" . N("Mandriva Online Account successfully created.\nPlease click \"Next\" to authenticate and upload your configuration\n") : $createaccount;
},
- noaccount => {
- name => N("Create a Mandriva Online Account"),
- data => sub {
- [
- { label => N("Greeting:"), val => \$greeting, list => [ @greets ], type => 'combo'},
- { label => N("First name:"), val => \$firstname },
- { label => N("Last name:"), val => \$lastname },
- { label => N("Email address:"), val => \$account },
- { label => N("Password:"), val => \$npassword, hidden => 1 },
- { label => N("Confirm Password:"), val => \$cfmpassword, hidden => 1 },
- ];
- },
- post => sub {
- $gr = find_index { /$gr/ } @greets;
- $alias = $firstname . $lastname;
- @info = ($account, $npassword, $firstname, $lastname, $lang, $greeting, $alias, 'home');
- $createaccount = $npassword ne $cfmpassword ? N("The passwords do not match\n Please try again\n") : (!$account || !$firstname || !$lastname) ? N("Please fill in each field") : mdkonline::check_valid_email($email) == 0 ? N("Not a valid mail address!\n") : mdkonline::create_authenticate_account('create', @info);
- "createaccount";
- }
- },
- createaccount => {
- name => sub {
- $createaccount eq 'OK' ? "\n\n" . N("Mandriva Online Account successfully created.\nPlease click \"Next\" to authenticate and upload your configuration\n") : $createaccount;
- },
- post => sub {
- $createaccount eq 'OK' ? "account" : "noaccount";
- }
- },
- upload => {
- name => sub {
- if ($sendconfres eq 'TRUE' && $key) {
- "\n\n" . N("Your upload was successful!") . "\n\n" . N("From now you will receive on security and updates \nannouncements thanks to Mandriva Online.") . "\n\n" . N("Mandriva Online offers you the ability to automate the updates.\nA program will run regulary in your system waiting for new updates\n");
- } else {
- N("Connection problem") . N("Problem occurs when uploading files, please try again");
- }
- },
- data => sub {
- if ($sendconfres eq 'TRUE' && $key) {
- [
- { label => N("Country"), val => \$country, type => "combo", list => [ sort keys %countries ], not_edit => 0 }
- ];
- }
- },
- post => sub {
- if ($sendconfres eq 'TRUE' && $key) {
- mdkonline::automated_upgrades($conffile, $login, md5_hex($password), $boxname, $key, $country, 'TRUE');
- mdkonline::write_wide_conf($login, $boxname, $country);
- mdkonline::clean_confdir();
- "end";
- } else {
- "authenticate";
- }
- },
- },
- end => {
- name => sub {
- N("Congratulations") . "\n\n" . N("Your Mandriva Online account has been successfully configured\n");
+ post => sub {
+ $createaccount eq 'OK' ? "account" : "noaccount";
+ }
+ },
+ upload => {
+ name => sub {
+ if ($sendconfres eq 'TRUE' && $key) {
+ "\n\n" . N("Your upload was successful!") . "\n\n" . N("From now you will receive on security and updates \nannouncements thanks to Mandriva Online.") . "\n\n" . N("Mandriva Online offers you the ability to automate the updates.\nA program will run regulary in your system waiting for new updates\n");
+ } else {
+ N("Connection problem") . N("Problem occurs when uploading files, please try again");
+ }
+ },
+ data => sub {
+ if ($sendconfres eq 'TRUE' && $key) {
+ [
+ { label => N("Country"), val => \$country, type => "combo", list => [ sort keys %countries ], not_edit => 0 }
+ ];
+ }
+ },
+ post => sub {
+ if ($sendconfres eq 'TRUE' && $key) {
+ mdkonline::automated_upgrades($conffile, $login, md5_hex($password), $boxname, $key, $country, 'TRUE');
+ mdkonline::write_wide_conf($login, $boxname, $country);
+ mdkonline::clean_confdir();
+ "end";
+ } else {
+ "authenticate";
+ }
+ },
+ },
+ end => {
+ name => sub {
+ N("Congratulations") . "\n\n" . N("Your Mandriva Online account has been successfully configured\n");
},
- end => 1,
- no_back => 1,
- next => 0,
- }
- }
- };
+ end => 1,
+ no_back => 1,
+ next => 0,
+ }
+ }
+ });
if (!$ia && $login && $password && $boxname) {
$is_success = mdkonline::create_authenticate_account('authenticate', $login, $password);
if ($is_success eq 'OK') {
($sendconfres, $key) = send_conf($login, $password, $boxname);
+ print "RESULT = $sendconfres - $key";
if ($sendconfres eq 'TRUE' && $key) {
mdkonline::automated_upgrades($conffile, $login, md5_hex($password), $boxname, $key, $country, 'TRUE');
mdkonline::write_wide_conf($login, $boxname, $country);
@@ -226,5 +228,5 @@ if (!$ia && $login && $password && $boxname) {
output_p($logfile, N("Cannot connect to Mandriva Online website: wrong login/password or router/firewall bad settings"));
}
} else {
- wizards->new->safe_process($wiz, $in);
+ $wiz->safe_process($in);
}