summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmdkonline1
-rw-r--r--mdkonline.pm5
-rw-r--r--mdkonline.spec2
-rwxr-xr-xmdkupdate43
4 files changed, 27 insertions, 24 deletions
diff --git a/mdkonline b/mdkonline
index 2698f637..9c5ae14f 100755
--- a/mdkonline
+++ b/mdkonline
@@ -190,6 +190,7 @@ $wiz = {
post => sub {
mdkonline::automated_upgrades($conffile, $login, md5_hex($password), $boxname, $key, $country, 'TRUE');
mdkonline::write_wide_conf($login, $boxname, $country);
+ mdkonline::clean_confdir();
"end"
},
},
diff --git a/mdkonline.pm b/mdkonline.pm
index 994aaee5..b33a3de8 100644
--- a/mdkonline.pm
+++ b/mdkonline.pm
@@ -176,6 +176,11 @@ sub mv_files {
-e $source and system("mv", $source, $dest);
}
+sub clean_confdir {
+ my $confdir = '/root/.MdkOnline';
+ system "/bin/rm", "-f", "$confdir/*log.bz2", "$confdir/*log.bz2.uue", "$confdir/*.dif $confdir/rpm_qa_installed_before", "$confdir/rpm_qa_installed_after";
+}
+
sub hw_upload {
my ($login, $passwd, $hostname) = @_;
my $hw_exec = '/usr/sbin/hwdb_add_system';
diff --git a/mdkonline.spec b/mdkonline.spec
index e84fdb18..863ef12a 100644
--- a/mdkonline.spec
+++ b/mdkonline.spec
@@ -113,7 +113,7 @@ rm -rf $RPM_BUILD_ROOT
# get the source from our cvs repository (see
# http://www.linuxmandrake.com/en/cvs.php3)
%changelog
-* Thu Nov 4 2004 Daouda LO <daouda@mandrakesoft.com> 1.1-20mdk
+* Fri Nov 19 2004 Daouda LO <daouda@mandrakesoft.com> 1.1-20mdk
- remerge mdkonline to one package
- superseded gtk based wizard by interactive one
- MNF support (config upload and misc)
diff --git a/mdkupdate b/mdkupdate
index e38af8e3..2d3a07a0 100755
--- a/mdkupdate
+++ b/mdkupdate
@@ -31,6 +31,10 @@ require_root_capability();
my $confdir = '/root/.MdkOnline';
my $conffile = "$confdir/mdkupdate";
+my $difflog = '/tmp/diff.log';
+
+my $currentrpm = "$confdir/rpm_qa_installed_current";
+my $afterrpm = "$confdir/rpm_qa_installed_after";
my $logfile = '/tmp/mdkupdate.log';
@@ -73,7 +77,7 @@ if ($o{LOGIN} && $o{PASS} && $o{LOGIN} !~ /\s+/ && $o{PASS} !~ /\s+/) {
my $resp = mdkonline::get_from_URL($MandrakeUpdateURL, 'MdkUpdateAgent');
my $contents = $resp->content;
#print "CONTENTS = $contents \n";
- -e $logfile and system "/bin/rm", "$logfile";
+ -e $logfile and system "/bin/rm", $logfile;
if ($resp->is_success) {
if ($contents =~ /TRUE/) { $u = 10 } elsif ($contents =~ m/(\d+)/) { $u = sprintf("%d", $1) } else { $u = 83 };
my $action = {
@@ -90,21 +94,20 @@ if ($o{LOGIN} && $o{PASS} && $o{LOGIN} !~ /\s+/ && $o{PASS} !~ /\s+/) {
$scheduled = join(',', @{$c2h->{sched}});
$noscheduled = join(',', @{$c2h->{nosched}}); $noscheduled =~ s/\.rpm//g;
#printf "SCHEDULED = $scheduled\nNOSCHEDULED = $noscheduled\n";
+ -f $currentrpm or rpm_qa($currentrpm);
if ($opt eq '--applet') {
- system "/usr/bin/MandrakeUpdate", "--no-confirmation", "--media=mdkupdate", "--pkg-sel=$scheduled", "--pkg-nosel=$noscheduled";
+ system "/usr/bin/MandrakeUpdate", "--no-confirmation", "--media=mdkupdate", "--pkg-sel=$scheduled", "--pkg-nosel=$noscheduled"
} elsif ($opt eq '--auto') {
- $o{AUTO} eq 'TRUE' and auto_install_rpms($c2h->{sched});
+ $o{AUTO} eq 'TRUE' and auto_install_rpms($c2h->{sched})
}
- rpm_qa("$confdir/rpm_qa_installed_after");
+ rpm_qa($afterrpm);
my %new = getVarsFromSh($conffile);
- if (! -s "$confdir/mdkupdate.rpms" || $opt eq '--auto') {
+ my $need_upload = get_rpm_dif();
+ if ($need_upload || $opt eq '--auto') {
#- send configuration and get back key to use...
my $r;
($r, $new{CURRENTKEY}) = send_conf_update($new{LOGIN}, $new{PASS}, $new{MACHINE});
if ($r eq 'TRUE') { delete $new{OLDKEY}; setVarsInSh($conffile, \%new) }
- } else {
- #- this can safely be ignored if new configuration is sent.
- send_rpm_dif($new{LOGIN}, $new{PASS}, $new{MACHINE}, $new{OLDKEY});
}
clean_dir();
},
@@ -185,23 +188,17 @@ sub send_conf_update {
my ($res, $key) = mdkonline::send_config($url->{wizard}, $tag);
($res, $key)
}
-sub send_rpm_dif {
- my ($login, $password, $boxname, $oldkey) = @_;
- `sdiff -s $confdir/rpm_qa_installed_after $confdir/mdkupdate.rpms > $confdir/$login.$password.$boxname.$oldkey.dif`;
- -s "$confdir/$login.$password.$boxname.$oldkey.dif" or exit(1);
- my $tag = { submit => "upload_dif", dif_file => [ "$confdir/$login.$password.$boxname.$oldkey.dif" ] };
- my ($res, $key) = mdkonline::send_config($url->{online_dif}, $tag);
- #- update mdkupdate.rpms with newer version just sent.
- if ($res eq 'TRUE') {
- unlink "$confdir/mdkupdate.rpms";
- rename "$confdir/rpm_qa_installed_after", "$confdir/mdkupdate.rpms";
- } else {
- output($logfile, 'send_rpm_dif' . N("Connection problem") . "\n" . N("Mandrakeupdate could not upload the diff files. Send a mail to support [at] mandrakeonline [dot] net"));
- return
- }
+sub get_rpm_diff {
+ my $isdif = `sdiff -s $afterrpm $currentrpm`;
+ $isdif and output($difflog, $isdif), return 1;
+ return 0
+}
+sub new_rpm_base {
+ -f $afterrpm and system('/bin/mv', $afterrpm, $currentrpm);
}
sub clean_dir() {
- system "/bin/rm", "-f", "$confdir/*log.bz2", "$confdir/*log.bz2.uue", "$confdir/*.dif $confdir/rpm_qa_installed_before", "$confdir/rpm_qa_installed_after";
+ new_rpm_base();
+ mdkonline::clean_confdir();
output($logfile, 'OK')
}
sub rpm_qa {