summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmdkapplet91
-rwxr-xr-xmdkonline66
-rw-r--r--mdkonline.spec16
3 files changed, 102 insertions, 71 deletions
diff --git a/mdkapplet b/mdkapplet
index edec1709..5e103539 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -53,7 +53,7 @@ my $localfile = "$localdir/mdkonline";
mkdir_p($localdir) if !-d $localdir;
-e "$ENV{HOME}/.mdkonline" and system("mv", "$ENV{HOME}/.mdkonline", $localfile);
-mdkonline::is_running('mdkapplet') and die "mdkapplet already running\n";
+is_running('mdkapplet') and die "mdkapplet already running\n";
my %state = (
okay => {
@@ -132,9 +132,8 @@ $eventbox->signal_connect(button_press_event => sub {
$_[1]->button == 3 && $menu and $menu->popup(undef, undef, undef, undef, $_[1]->button, $_[1]->time);
});
my ($opt) = @ARGV;
-if ($opt eq '--force' || $opt eq '-f') { setAutoStart('TRUE') };
-
-if ($opt eq '--debug') { $debug = 1}
+if ($opt eq '--force' || $opt eq '-f') { setAutoStart('TRUE') }
+if ($opt eq '--debug') { $debug = 1 }
shouldStart() or die "$localfile should be set to TRUE: please use --force or -f option to launch applet";
@@ -174,12 +173,13 @@ sub showMainWindow() {
1, create_scrolled_window(gtktext_insert($textvw, refresh_contents($state_global), wrap_mode => 'none')))),
0, gtkpack(Gtk2::HSeparator->new),
0, gtkpack(gtksignal_connect(Gtk2::Button->new(N("Close")), clicked => sub {
- if (defined $wlog) { $wlog->destroy; undef $wlog }; $w->destroy; $raisedwindow = 0;
+ if (defined $wlog) { $wlog->destroy; undef $wlog }
+ $w->destroy; $raisedwindow = 0;
})
)
)
);
- $w->show_all
+ $w->show_all;
}
sub md5file {
my @md5;
@@ -205,7 +205,7 @@ sub refresh_contents {
my $color = {};
my %h = getVarsFromSh($conffile);
foreach my $l (['first', 'red'], ['second', 'royalblue3'], ['third', 'green']) {
- $color->{$l->[0]} = { 'foreground' => $l->[1], 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD }
+ $color->{$l->[0]} = { 'foreground' => $l->[1], 'weight' => Gtk2::Pango->PANGO_WEIGHT_BOLD };
}
my $fixed_tag = { 'font' => 'monospace' };
setLastTime();
@@ -215,7 +215,7 @@ sub refresh_contents {
[ N("Machine name:"), $color->{second} ], [ $h{MACHINE} . "\n", $fixed_tag ],
[ N("Updates: "), $color->{second} ], [ common::sprintf_fixutf8($state{$status}{tt}[0]), $status eq 'okay' ? $color->{third} : $color->{first} ],
];
- $contents
+ $contents;
}
sub configNetwork() { logIt(N("Launching drakconnect\n")); system "/usr/sbin/drakconnect &" }
sub installUpdates {
@@ -224,29 +224,29 @@ sub installUpdates {
logIt(N("Launching mdkupdate --applet\n"));
system "/usr/sbin/mdkupdate", "--applet";
my $newmd5 = md5file($binfile);
- if ($newmd5 ne $oldmd5) { logIt(N("Mandrakeonline seems to be reinstalled, reloading applet ....")); exec('/usr/bin/mdkapplet') };
- my $w = $in->wait_message(N("Please wait"), N("Check updates"));
+ if ($newmd5 ne $oldmd5) { logIt(N("Mandrakeonline seems to be reinstalled, reloading applet ....")); exec('/usr/bin/mdkapplet') }
+ #my $w = $in->wait_message(N("Please wait"), N("Check updates"));
silentCheck(); gtkflush();
- undef $w;
+ #undef $w;
my $mdkupdate_status = cat_('/var/tmp/mdkupdate.log');
if ($mdkupdate_status && $mdkupdate_status !~ /OK/) { logIt($mdkupdate_status); $in->ask_warn(N("Mandrakelinux Updates Applet"), $mdkupdate_status) }
}
sub silentCheck {
my $link = $online_site . "/online3_RemoteAction.php" . '?action=UpdateList';
my %h = getVarsFromSh($conffile);
- my $u;
+ my ($u, $ct);
logIt(N("Computing new updates...\n"));
my $link = $link . '&log=' . $h{LOGIN} . '&host=' . $h{MACHINE};
logIt(N("Connecting to") . " $link ...\n");
gtkflush(); go2State('busy'); gtkflush();
-# print "$link\n";
my $response = mdkonline::get_from_URL($link, 'MdkAppletAgent/0.1');
- my $ct = $response->content;
+ $response->is_success or go2State('disconnected'), return;
+ $ct = $response->content;
if ($debug) {
print "\nCONTENTS = $ct\n" if $debug;
- logIt(N("Response from Mandrakeonline server\n") . "$ct");
+ logIt(N("Response from Mandrakeonline server\n") . $ct);
}
- if ($ct =~ /rpm/) { $u = 11 } elsif ($ct =~ m/(\d+)/) { $u = sprintf("%d", $1) } else { $u = 10 };
+ if ($ct =~ /rpm/) { $u = 11 } elsif ($ct =~ m/(\d+)/) { $u = sprintf("%d", $1) } else { $u = 10 }
# 99 - log or host or action or pass empty, wrong action
# 98 - wrong pass
# 97 - host not active
@@ -259,7 +259,7 @@ sub silentCheck {
my $comp = 0;
foreach my $cand (@contents) {
$cand =~ s/\.(i586|ppc|ia64|noarch|x86_64|amd64|ppc64).rpm//;
- $cand =~ /(.*)-(.*)-(.*)$/; my ($name, $ver, $rel) = ($1, $2, $3);
+ my ($name, $ver, $rel) = $cand =~ /(.*)-(.*)-(.*)$/;
$comp = compareWithInstalled($name, $ver, $rel, \@t);
#print "COMP = $comp\n";
if ($comp) { $isAvailable = 1; logIt(N("Checking... Updates are available\n") . "\n"); go2State('error') } else { $isAvailable = 0 }
@@ -275,24 +275,24 @@ sub silentCheck {
99 => sub { logIt(N("Wrong Action or host or login.\n")); go2State('critical') },
500 => sub { logIt(N("Something is wrong with your network settings (check your route, firewall or proxy settings)\n")); go2State('critical') }
};
- eval { $retcode->{$u}->() }; if ($@) { logIt(N("Problem occurred while connecting to the server, please contact the support team")); go2State('critical') }
+ eval { $retcode->{$u}->() }; if ($@) { logIt(N("Problem occured while connecting to the server, please contact the support team")); go2State('critical') }
}
sub okState { $isAvailable = 0; logIt(N("System is up-to-date\n")); go2State('okay') }
sub compareWithInstalled {
my ($name, $ver, $rel, $t) = @_;
my $isUpdate = 0;
foreach my $p (@$t) {
- $p =~ /(.*)-(.*)-(.*)$/; my ($n, $v, $r) = ($1, $2, $3);
- if ($name eq $n && $name !~ /kernel/) {
+ my ($n, $v, $r) = $p =~ /(.*)-(.*)-(.*)$/;
+ if ($name eq $n) {
my ($iu, $ir);
- if ($debug) { $iu = mdkonline::rpm_ver_cmp($ver, $v); $ir = mdkonline::rpm_ver_cmp($rel, $r) };
+ if ($debug) { $iu = mdkonline::rpm_ver_cmp($ver, $v); $ir = mdkonline::rpm_ver_cmp($rel, $r) }
if (mdkonline::rpm_ver_cmp($ver, $v) > 0 || mdkonline::rpm_ver_cmp($ver, $v) == 0 && mdkonline::rpm_ver_cmp($rel, $r) > 0) {
logIt("$name-$ver-$rel $n-$v-$r *** CMPVER=$iu ** CMPREL = $ir \n") if $debug;
$isUpdate = 1 and last;
}
}
}
- $isUpdate
+ $isUpdate;
}
sub cronUpdate {
Glib::Timeout->add(10*1000, sub {
@@ -309,24 +309,24 @@ sub lastCheck {
my ($t, $l);
$t = $h{LASTCHECK};
$t =~ s/_/ /g;
- $t ? $t : N("No check")
+ $t || N("No check");
}
sub getTime {
my $d = localtime();
$d =~ s/\s+/_/g;
- $d
+ $d;
}
sub setLastTime {
my $date = getTime();
setVar($localfile, 'LASTCHECK', $date);
}
sub checkConfig {
- if (!isNetwork()) {
- logIt(N("Checking Network: seems disabled\n"));
- go2State('disconnected')
- } elsif (!-e $conffile) {
+ if (!-e $conffile) {
logIt(N("Checking config file: Not present\n"));
- go2State('noconfig')
+ go2State('noconfig');
+ } elsif (!isNetwork()) {
+ logIt(N("Checking Network: seems disabled\n"));
+ go2State('disconnected');
} elsif (member($state_global, qw(disconnected noconfig))) {
silentCheck(); #- state has changed, update
}
@@ -336,14 +336,26 @@ sub checkUpdates {
}
sub go2State {
my $state = shift;
- $menu && $menu->destroy;
+ $menu->destroy if $menu;
$menu = setState($state);
$state_global = $state;
defined $textvw and refresh_status($state);
}
sub isNetwork {
+ my ($netcnx, $netc, $intf) = ({}, {}, {});
+ my $r = mdkonline::get_release();
+ # my $h = mdkonline::get_distro_type();
my $network;
- $network = gethostbyname("mandrakeonline.net") ? 1 : 0;
+ if ($r <= 10.0) {
+ $network = gethostbyname("mandrakeonline.net") ? 1 : 0;
+ } else {
+ print "requiring net_connect";
+ require network::netconnect;
+ require network::tools;
+ network::netconnect::read_net_conf($netcnx, $netc, $intf);
+ my ($gw_intf, $is_up, $gw_address, $dns_server) = network::tools::get_internet_connection($netc, $intf);
+ $network = $gw_address ? 1 : 0;
+ }
$network;
}
sub configure {
@@ -356,7 +368,7 @@ sub configure {
1;
});
}
-sub displayLogs {
+sub dislayLogs {
my $w = ugtk2->new(N("Logs"), center => 1);
gtkset_size_request($w->{window}, 500, 400);
$w->{window}->signal_connect(delete_event => sub { $w->destroy; undef $wlog });
@@ -370,7 +382,7 @@ sub displayLogs {
0, gtksignal_connect(my $close = Gtk2::Button->new(N("Close")),
clicked => sub {
$w->destroy;
- undef $wlog
+ undef $wlog;
}),
1, Gtk2::Label->new(""),
0, gtksignal_connect(my $clear = Gtk2::Button->new(N("Clear")),
@@ -379,12 +391,12 @@ sub displayLogs {
$buffer->set_text($mLog);
}),
)));
- $w
+ $w;
}
sub shouldStart() {
my %p = getVarsFromSh($localfile);
my $ret = $p{AUTOSTART} eq 'FALSE' ? 0 : 1;
- $ret
+ $ret;
}
sub setState {
my $state_type = shift;
@@ -404,15 +416,13 @@ sub setState {
$menu->append(gtksignal_connect(gtkset_active($checkme = Gtk2::CheckMenuItem->new_with_label(N("Always launch on startup")), shouldStart()), toggled => sub { setAutoStart(uc(bool2text($checkme->get_active))) }));
$checkme->show;
$menu->append(gtksignal_connect(gtkshow(Gtk2::MenuItem->new_with_label(N("Quit"))), activate => sub { mainQuit() }));
- $menu
+ $menu;
}
sub logIt {
my $log = shift;
my ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime();
$mLog .= $Hour . ':' . $Minute . ':' . $Second . ' ' . $log;
- if (defined $wlog) {
- $buffer->insert_at_cursor($log)
- }
+ if (defined $wlog) { $buffer->insert_at_cursor($log) }
}
sub setVar {
my ($file, $var, $st) = @_;
@@ -433,5 +443,6 @@ LASTCHECK=$date
}
sub mainQuit() {
# setAutoStart('FALSE');
- Gtk2->main_quit
+ Glib::Source->remove($timeout) if $timeout;
+ Gtk2->main_quit;
}
diff --git a/mdkonline b/mdkonline
index cbcec800..639a31ce 100755
--- a/mdkonline
+++ b/mdkonline
@@ -31,13 +31,11 @@ use lang;
use Getopt::Long;
-BEGIN { unshift @::textdomains, 'mdkonline', 'drakfirstboot' };
+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});
@@ -70,7 +74,7 @@ sub read_conf() {
my %t = getVarsFromSh($wideconf);
my $host = chomp_(`hostname`);
$t{MACHINE} ||= $1 if $host =~ /(\w+)(.*)/;
- $login = $t{LOGIN}; $boxname = $t{MACHINE}
+ $login = $t{LOGIN}; $boxname = $t{MACHINE};
}
sub check_login {
my ($log, $pass, $box) = @_;
@@ -80,27 +84,27 @@ sub check_login {
my $clink = $expert_link . '/firsttimewizard/validusercheck.php' . '?u=' . $log . '&p=' . $pp;
$resp = mdkonline::get_from_URL($clink, "MdkOnline_tuiAgent/");
$resp->is_success and $res = $resp->content =~ /TRUE/ ? 1 : 0;
- $res
+ $res;
}
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;
- ($sendconfres, $key)
+ undef $ww if $ww;
+ ($sendconfres, $key);
}
sub create_new_account {
my ($log, $pass, $mail) = @_;
my $url = $expert_link . '/online3_CreateAccount.php' . '?desuserid=' . $log . '&despwd=' . $pass . '&user_email=' . $mail;
my $ca = mdkonline::subscribe_online($url);
- $ca
+ $ca;
}
$wiz = {
name => N("Mandrakeonline"),
@@ -125,27 +129,27 @@ $wiz = {
{ label => N("Login:"), val => \$login },
{ label => N("Password:"), val => \$password, hidden => 1 },
{ label => N("Machine name:"), val => \$boxname },
- ],
+ ];
},
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"
+ "authenticate";
},
},
authenticate => {
name => sub {
if ($is_success) {
- N("In order to benefit from Mandrakeonline services,\nwe are about to upload your configuration.\n\nThe Wizard will now send the following information to Mandrakesoft:\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.mandrakeexpert.com.")
+ N("In order to benefit from Mandrakeonline services,\nwe are about to upload your configuration.\n\nThe Wizard will now send the following information to Mandrakesoft:\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.mandrakeexpert.com.");
} else {
- 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 Mandrakeonline.\n In the latter case, go back to the first step to connect to Mandrakeonline.\n Be aware that you must also provide a Machine name \n (only alphabetical characters are admitted)")
+ 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 Mandrakeonline.\n In the latter case, go back to the first step to connect to Mandrakeonline.\n Be aware that you must also provide a Machine name \n (only alphabetical characters are admitted)");
}
},
no_back => $is_success ? 1 : 0,
post => sub {
if ($is_success) {
($sendconfres, $key) = send_conf($login, $password, $boxname);
- "upload"
+ "upload";
} else { "choices" }
}
},
@@ -157,11 +161,11 @@ $wiz = {
{ label => N("Password:"), val => \$npassword, hidden => 1 },
{ label => N("Confirm Password:"), val => \$cfmpassword, hidden => 1 },
{ label => N("Mail contact:"), val => \$email },
- ]
+ ];
},
post => sub {
$createaccount = $npassword ne $cfmpassword ? N("The passwords do not match\n Please try again\n") : $nlogin eq '' ? N("Please provide a login") : mdkonline::check_valid_email($email) == 0 ? N("Not a valid mail address!\n") : create_new_account($nlogin, $npassword, $email);
- "createaccount"
+ "createaccount";
}
},
createaccount => {
@@ -169,7 +173,7 @@ $wiz = {
$createaccount eq 'OK' ? "\n\n" . N("Mandrakeonline Account successfully created.\nPlease click \"Next\" to authenticate and upload your configuration\n") : $createaccount;
},
post => sub {
- $createaccount eq 'OK' ? "account" : "noaccount"
+ $createaccount eq 'OK' ? "account" : "noaccount";
}
},
upload => {
@@ -177,14 +181,14 @@ $wiz = {
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 Mandrakeonline.") . "\n\n" . N("Mandrakeonline 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")
+ 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 {
@@ -192,15 +196,15 @@ $wiz = {
mdkonline::automated_upgrades($conffile, $login, md5_hex($password), $boxname, $key, $country, 'TRUE');
mdkonline::write_wide_conf($login, $boxname, $country);
mdkonline::clean_confdir();
- "end"
+ "end";
} else {
- "authenticate"
+ "authenticate";
}
},
},
end => {
name => sub {
- N("Congratulations") . "\n\n" . N("Your Mandrakeonline account has been successfully configured\n")
+ N("Congratulations") . "\n\n" . N("Your Mandrakeonline account has been successfully configured\n");
},
end => 1,
no_back => 1,
@@ -209,16 +213,18 @@ $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);
if ($sendconfres eq 'TRUE' && $key) {
mdkonline::automated_upgrades($conffile, $login, md5_hex($password), $boxname, $key, $country, 'TRUE');
mdkonline::write_wide_conf($login, $boxname, $country);
- output_p($logfile, N("Configuration uploaded successfully"))
+ output_p($logfile, N("Configuration uploaded successfully"));
} else { output_p($logfile, N("Problem uploading configuration")) }
- } else { output_p($logfile, N("Cannot connect to mandrakeonline website: wrong login/password or router/firewall bad settings")) }
+ } else {
+ output_p($logfile, N("Cannot connect to mandrakeonline website: wrong login/password or router/firewall bad settings"));
+ }
} else {
wizards->new->safe_process($wiz, $in);
}
diff --git a/mdkonline.spec b/mdkonline.spec
index 51055959..2efef2e8 100644
--- a/mdkonline.spec
+++ b/mdkonline.spec
@@ -1,6 +1,6 @@
%define version 1.1
%define name mdkonline
-%define release 27mdk
+%define release 29mdk
Summary: The MandrakeOnline Tool
Name: %{name}
@@ -115,9 +115,23 @@ rm -rf $RPM_BUILD_ROOT
# http://www.linuxmandrake.com/en/cvs.php3)
%changelog
+* Tue Mar 8 2005 Daouda LO <daouda@mandrakesoft.com> 1.1-29mdk
+- added option --interactive (to use nointeractive in MNF)
+- MandrakeUpdate in newt version (only for update_source media)
+- fix the x86_64 coupled with corporate capharnaum
+- No more dns request to check mandrakeonline server's "reachability"
+ (release > 10.0)
+- many cleanups
+
+ o Wed Feb 16 2005 Daouda LO <daouda@mandrakesoft.com> 1.1-28mdk
+ - don't update kernel
+ - added --mnf option to mdkupdate
+ - don't check the network if no config file is available
+
* Wed Jan 19 2005 Daouda LO <daouda@mandrakesoft.com> 1.1-27mdk
- truly support x86_64 (good path to synthesis and RPMS repertory)
- mdkupdate media renamed to update_source (consolidating with MandrakeUpdate)
+- fixed last checked date not refreshing
* Wed Dec 29 2004 Daouda LO <daouda@mandrakesoft.com> 1.1-26mdk
- display last check date on applet interface