From 13f32f436f0775dd7c1c6caa16e92a2dc67af73d Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Fri, 11 Oct 2002 08:21:42 +0000 Subject: cleaned code a bit (use tempory copy of rpms installed instead of building new one when sending configuration). --- mdkupdate | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mdkupdate b/mdkupdate index e5739ac4..09ad4d76 100755 --- a/mdkupdate +++ b/mdkupdate @@ -69,10 +69,6 @@ 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... $new{CURRENTKEY} = send_config($new{LOGIN},$new{PASS},$new{BOX}); delete $new{OLDKEY}; @@ -147,6 +143,9 @@ sub send_config { $result = ($response->content =~ /TRUE(.*)/) ? 0 : -1; #print("key is $1\n"); $key = $1; + #- update local copy now. + unlink "/root/.mdkupdate.rpms"; + rename "/root/rpm_qa_installed_after", "/root/.mdkupdate.rpms"; } else { # pb with the connection ? $result = -1; @@ -259,8 +258,7 @@ sub clean_dir { sub rpm_qa { my ($file) = @_; open (FILE,"> $file") || die "Couldn't open $file : $!"; - join '', map { chomp; print FILE "$_" } - join('',sort `rpm -qa`); + map { chomp; print FILE "$_" } join('',sort `rpm -qa`); close FILE; } -- cgit v1.2.1