summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-10-10 14:38:41 +0000
committerFrancois Pons <fpons@mandriva.com>2002-10-10 14:38:41 +0000
commit316eb76720880c2e708440ec8c4697cb94cabd10 (patch)
tree9aee35b5c1754e4d53c686f568a6ba1e129d25b8
parent8ed91f882afe9a535cca19dbdbcec1e9729648a8 (diff)
downloadmgaonline-316eb76720880c2e708440ec8c4697cb94cabd10.tar
mgaonline-316eb76720880c2e708440ec8c4697cb94cabd10.tar.gz
mgaonline-316eb76720880c2e708440ec8c4697cb94cabd10.tar.bz2
mgaonline-316eb76720880c2e708440ec8c4697cb94cabd10.tar.xz
mgaonline-316eb76720880c2e708440ec8c4697cb94cabd10.zip
finally got the stuff to work.
-rwxr-xr-xmdkonline10
-rw-r--r--mdkonline.spec2
-rwxr-xr-xmdkupdate50
3 files changed, 36 insertions, 26 deletions
diff --git a/mdkonline b/mdkonline
index bf9c21d0..1110d520 100755
--- a/mdkonline
+++ b/mdkonline
@@ -319,11 +319,6 @@ sub send_config {
# print STDERR "Sending config\n";
my $result = -1;
- #- added to allow .mdkupdate.rpms file creation.
- open FILE, ">/root/.mdkupdate.rpms" or die "Couldn't open /root/.mdkupdate.rpms : $!";
- print FILE join ('', sort `rpm -qa`);
- close FILE;
-
report_config("/root/$login.$passwd.$box_name.online.log");
`/usr/bin/bzip2 \\\-9 \\\-f /root/$login.$passwd.$box_name.online.log`;
@@ -360,6 +355,11 @@ sub send_config {
# if informations were sent correctly (exit code: 0 from scp script), go to page 5
if (! $result) {
+ #- added to allow .mdkupdate.rpms file creation.
+ open FILE, ">/root/.mdkupdate.rpms" or die "Couldn't open /root/.mdkupdate.rpms : $!";
+ print FILE join ('', sort `rpm -qa`);
+ close FILE;
+
# go to last page
$notebook_global->set_page(5);
} else {
diff --git a/mdkonline.spec b/mdkonline.spec
index 3ed68cf1..3c31c083 100644
--- a/mdkonline.spec
+++ b/mdkonline.spec
@@ -82,7 +82,7 @@ rm -rf $RPM_BUILD_ROOT
%{_liconsdir}/*.png
%changelog
-* Wed Oct 9 2002 François Pons <fpons@mandrakesoft.com> 0.17-1mdk
+* Thu Oct 10 2002 François Pons <fpons@mandrakesoft.com> 0.17-1mdk
- fixed to make sure the list of rpm is always sent to server.
- use urpmi media for update in order to use non scheduled packages.
- fixed to propagate version to user agent.
diff --git a/mdkupdate b/mdkupdate
index 393fd659..2e3efb9a 100755
--- a/mdkupdate
+++ b/mdkupdate
@@ -40,7 +40,7 @@ sub _ {
sprintf(Locale::gettext::gettext($format), @params);
}
-$logfile = "/var/log/mdkupdate.log";
+my $logfile = "/var/log/mdkupdate.log";
my $url_upload_diff = "https://www.mandrakeonline.net/online_dif.php";
my $url_get_rpms = "https://www.mandrakeonline.net/online_update.php";
my $rpms_rep = "/root/tmp/";
@@ -65,19 +65,23 @@ usage:
grep { $_ !~ /^-?-(v|update|security)$/ } @ARGV and usage;
my %o = getVarsFromSh("/root/.mdkupdate");
+update_rpms($o{LOGIN},$o{PASS},$o{BOX},$o{CURRENTKEY});
+rpm_qa("/root/rpm_qa_installed_after");
+my %new = getVarsFromSh("/root/.mdkupdate");
if (! -s "/root/.mdkupdate.rpms" || $update) {
#- added to allow .mdkupdate.rpms file creation.
open FILE, ">/root/.mdkupdate.rpms" or die "Couldn't open /root/.mdkupdate.rpms : $!";
print FILE join ('', sort `rpm -qa`);
close FILE;
#- send configuration and get back key to use...
- $o{CURRENTKEY} = send_config($o{LOGIN},$o{PASS},$o{BOX});
+ $new{CURRENTKEY} = send_config($new{LOGIN},$new{PASS},$new{BOX});
+ delete $new{OLDKEY};
+ #- save back keys.
+ setVarsInSh("/root/.mdkupdate", \%new);
+} else {
+ #- this can safely be ignored if new configuration is sent.
+ send_rpm_dif($new{LOGIN},$new{PASS},$new{BOX},$new{OLDKEY});
}
-#rpm_qa("/root/rpm_qa_installed_before");
-update_rpms($o{LOGIN},$o{PASS},$o{BOX},$o{CURRENTKEY});
-rpm_qa("/root/rpm_qa_installed_after");
-my %new = getVarsFromSh("/root/.mdkupdate");
-send_rpm_dif($new{LOGIN},$new{PASS},$new{BOX},$new{OLDKEY});
clean_dir();
################################################################################
@@ -140,7 +144,7 @@ sub send_config {
# Check the outcome of the response
#print "REPONSE: ".$response->content."\n";
if ($response->is_success) {
- $result = ($response->content =~ /^TRUE(.*)/) ? 0 : -1;
+ $result = ($response->content =~ /TRUE(.*)/) ? 0 : -1;
#print("key is $1\n");
$key = $1;
} else {
@@ -167,9 +171,9 @@ sub update_rpms {
my $response = $ua->request($request);
$string = $response->content;
if ($response->is_success) {
- $result = ($response->content =~ /^TRUE/) ? 0 : -1;
+ $result = ($response->content =~ /TRUE/) ? 0 : -1;
} else {
- log_it(_("Connection problem")."\n"._("MandrakeUpdate could not contact the site, we will try again"));
+ log_i(_("Connection problem")."\n"._("MandrakeUpdate could not contact the site, we will try again"));
clean_dir();
exit 1;
}
@@ -193,10 +197,10 @@ sub update_rpms {
my @junk= splice(@str_m,0,3);
my $mir_full = "ftp://$l{MIRROR}/$l{VER}/RPMS/";
update_packages($mir_full,@str_m);
- } else { log_it("problem occur $str_m\n"); }
+ } else { log_i("problem occur $str_m\n"); }
} else {
- log_it(_("Your login or password may be wrong")."\n"._("You'll need to have an account on MandrakeOnline, or update your subscription")."\n"._("For any problem send mail to support\@mandrakeonline.net\n"));
+ log_i(_("Your login or password may be wrong")."\n"._("You'll need to have an account on MandrakeOnline, or update your subscription")."\n"._("For any problem send mail to support\@mandrakeonline.net\n"));
clean_dir();
exit 1;
}
@@ -213,7 +217,7 @@ sub update_packages {
$? == 0 or die _("unable to update packages from mdkupdate medium\n");
};
$@ and die;
-# chdir($rpms_rep) or log_it("\ncannot chdir to $rpms_rep\n");
+# chdir($rpms_rep) or log_i("\ncannot chdir to $rpms_rep\n");
# $full_rpm = join(' ',@str);
# print "@str\n";
# foreach (@str) {
@@ -238,28 +242,34 @@ sub send_rpm_dif {
Content => [submit => "upload_dif",
dif_file => ["/root/$login.$password.$box_name.$oldkey.dif"]
]);
+ #- update .mdkupdate.rpms with newer version just sent.
+ if ($response->content =~ /TRUE/) {
+ unlink "/root/.mdkupdate.rpms";
+ rename "/root/rpm_qa_installed_after", "/root/.mdkupdate.rpms";
+ }
+
# Check the outcome of the response
print "REPONSE: ".$response->content."\n";
}
sub clean_dir {
- unlink "/root/.mdkupdate.rpms";
- rename "/root/rpm_qa_installed_after", "/root/.mdkupdate.rpms";
-
- system("rm -f /root/*.dif /root/rpm_qa_installed_before /root/rpm_qa_installed_after");
+ #system("rm -f /root/*.dif /root/rpm_qa_installed_before /root/rpm_qa_installed_after");
+ #system("rm -f /root/rpm_qa_installed_before /root/rpm_qa_installed_after");
}
sub rpm_qa {
my ($file) = @_;
open (FILE,"> $file") || die "Couldn't open $file : $!";
join '', map { chomp; print FILE "$_" }
- join('',sort `rpm -qa`);
+ join('',sort `rpm -qa`);
+ close FILE;
}
-sub log_it {
+sub log_i {
local *LOG;
- open LOG, ">> $logfile" or die "can't output to log file\n";
+ open LOG, ">>/var/log/mdkupdate.log" or die "can't output to log file\n";
print LOG @_;
+ close LOG;
}
sub fatal {