diff options
Diffstat (limited to 'mdkonline')
-rwxr-xr-x | mdkonline | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -36,8 +36,6 @@ BEGIN { unshift @::textdomains, 'mdkonline', 'drakfirstboot' } use mdkonline; use Digest::MD5 qw(md5 md5_hex md5_base64); -my $in = interactive->vnew('su'); - my $expert_link = 'http://www.mandrakeexpert.com'; my $online_link = 'https://www.mandrakeonline.net'; @@ -45,10 +43,18 @@ my $confdir = '/root/.MdkOnline'; my $conffile = "$confdir/mdkupdate"; my $logfile = '/var/tmp/mdkonline.log'; +my ($wiz, $login, $nlogin, $password, $npassword, $boxname, $cfmpassword, $email, $is_success, $key, $r, $createaccount, $sendconfres, $country, $ia); + +$ia = 1; + +GetOptions('interactive!' => \$ia, 'login=s' => \$login, 'pass=s' => \$password, 'box=s' => \$boxname, 'country:s' => \$country); + #for compatibilities mkdir_p($confdir) if !-d $confdir; -e '/root/.mdkupdate' and system("mv", "/root/.mdkupdate", $conffile); +my $in = interactive->vnew('su') if $ia; + $::Wizard_title = N("Mandrakeonline"); my %choices = ( @@ -58,9 +64,7 @@ my %choices = ( my $choice = $choices{account}; -my ($wiz, $login, $nlogin, $password, $npassword, $boxname, $cfmpassword, $email, $is_success, $key, $r, $createaccount, $sendconfres, $country); -GetOptions('login=s' => \$login, 'pass=s' => \$password, 'box=s' => \$boxname, 'country:s' => \$country); my %countries = map { lang::c2name($_) => $_ } lang::list_countries(); $country = lang::c2name(lang::read('', $>)->{country}); @@ -86,14 +90,14 @@ sub send_conf { my ($log, $pass, $box) = @_; my $uplink = $online_link . '/wizard.php'; my $pp = md5_hex($pass); - my $w = $in->wait_message(N("Please wait"), N("Reading configuration\n")); + my $w = $in->wait_message(N("Please wait"), N("Reading configuration\n")) if $ia; mdkonline::report_config("$confdir/$log.$pp.$box.online.log"); my $tag = { submit => "upload_wizard", wizard => ["$confdir/$log.$pp.$box.online.log.bz2.uue"] }; - undef $w; - my $ww = $in->wait_message(N("Please wait"), N("Sending configuration...")); + undef $w if $w; + my $ww = $in->wait_message(N("Please wait"), N("Sending configuration...")) if $ia; ($sendconfres, $key) = mdkonline::send_config($uplink, $tag); mdkonline::hw_upload($log, $pass, $box); - undef $ww; + undef $ww if $ww; ($sendconfres, $key); } sub create_new_account { @@ -128,7 +132,7 @@ $wiz = { ]; }, post => sub { - my $_wait = $in->wait_message(N("Please wait"), N("Connecting to Mandrakeonline website...")); + my $_wait = $in->wait_message(N("Please wait"), N("Connecting to Mandrakeonline website...")) if $ia; $is_success = check_login($login, $password, $boxname); undef($_wait); "authenticate"; }, @@ -209,7 +213,7 @@ $wiz = { } }; -if ($login && $password && $boxname) { +if (!$ia && $login && $password && $boxname) { $is_success = check_login($login, $password, $boxname); if ($is_success) { ($sendconfres, $key) = send_conf($login, $password, $boxname); |