diff options
-rw-r--r-- | NEWS | 3 | ||||
-rwxr-xr-x | mdkapplet | 20 | ||||
-rwxr-xr-x | mdkapplet-upgrade-helper | 2 | ||||
-rw-r--r-- | mdkonline.pm | 13 | ||||
-rwxr-xr-x | migrate-mdvonline-applet.pl | 70 |
5 files changed, 2 insertions, 106 deletions
@@ -1,6 +1,5 @@ - mdkapplet - o do not restart the applet on package update when performing distro - upgrade + o do not restart the applet on package update anymore Version 2.58 - 14 October 2008 @@ -38,13 +38,6 @@ use mdkonline; use Gtk2::Notify '-init', 'mdkapplet'; use Rpmdrake::open_db; -# POSIX unmasks the sigprocmask properly -my $sigset = POSIX::SigSet->new; -my $action = POSIX::SigAction->new('restart_applet', - $sigset, - &POSIX::SA_NODEFER); -POSIX::sigaction(&POSIX::SIGHUP, $action); - if (!find { $_ eq '--auto-update' } @ARGV) { if (my $pid = mdkonline::is_running('mdkapplet')) { die "mdkapplet already running ($pid)\n"; @@ -59,9 +52,6 @@ my ($menu, $timeout, $network_timeout, $state_global, $sub_state); my $localdir = "$ENV{HOME}/.MdkOnline"; my $localfile = "$localdir/mdkonline"; -my $release = mdkonline::get_release(); - - my %config = getVarsFromSh('/etc/sysconfig/mdkapplet'); $config{UPDATE_FREQUENCY} ||= 3*60*60; # default to 3hours $config{FIRST_CHECK_DELAY} ||= 5 * 60 * 1000; # default to 5 minutes @@ -350,12 +340,6 @@ sub harvester { sub configNetwork() { log::explanations(N_("Launching drakconnect\n")); fork_exec("/usr/sbin/drakconnect") } -sub restart_applet() { - return if $distro_upgrade; - log::explanations(N_("Mandriva Online seems to be reinstalled, reloading applet ....")); - exec($0, '--auto-update'); -} - sub confirm_upgrade() { local $mygtk2::left_padding = 0; my $width = 500; @@ -409,14 +393,10 @@ sub add_media() { } sub installUpdates() { - my $binfile = $0; return if $mdv_update_pid; - my $oldmd5 = $release <= 10.2 ? mdkonline::md5file($binfile) : common::md5file($binfile); log::explanations(N_("Launching MandrivaUpdate\n")); $mdv_update_pid = fork_exec('MandrivaUpdate', '--no-media-update', '--no-confirmation', '--no-splash', if_($root, "--urpmi-root=$root")); - my $newmd5 = $release <= 10.2 ? mdkonline::md5file($binfile) : common::md5file($binfile); - restart_applet() if $newmd5 ne $oldmd5; silentCheck(); gtkflush(); } diff --git a/mdkapplet-upgrade-helper b/mdkapplet-upgrade-helper index f2579d72..31383258 100755 --- a/mdkapplet-upgrade-helper +++ b/mdkapplet-upgrade-helper @@ -153,7 +153,7 @@ sub upgrade() { } sub fork_gurpmi { - run_program::run('gurpmi', '>>', $log_file, '--auto', '--auto-select', + run_program::run('gurpmi', '>>', $log_file, '2>>', $log_file, '--auto', '--auto-select', if_($root, "--urpmi-root=$root"), @_); } diff --git a/mdkonline.pm b/mdkonline.pm index dcae7795..0b381ca0 100644 --- a/mdkonline.pm +++ b/mdkonline.pm @@ -35,19 +35,6 @@ use log; my $release_file = find { -f $_ } '/etc/mandriva-release', '/etc/mandrakelinux-release', '/etc/mandrake-release', '/etc/redhat-release'; -sub md5file { - require Digest::MD5; - my @md5 = map { - my $sum; - if (open(my $FILE, $_)) { - binmode($FILE); - $sum = Digest::MD5->new->addfile($FILE)->hexdigest; - close($FILE); - } - $sum; - } @_; - return wantarray() ? @md5 : $md5[0]; -} sub get_release() { my ($r) = cat_($release_file) =~ /release\s+(\S+)/; diff --git a/migrate-mdvonline-applet.pl b/migrate-mdvonline-applet.pl deleted file mode 100755 index ca666398..00000000 --- a/migrate-mdvonline-applet.pl +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/perl -################################################################################ -# migrate-mdvonline-applet.pl # -# # -# Copyright (C) 2006 Mandriva # -# # -# Thierry Vignaud <tvignaud at mandriva dot com> # -# # -# This program is free software; you can redistribute it and/or modify # -# it under the terms of the GNU General Public License Version 2 as # -# published by the Free Software Foundation. # -# # -# This program is distributed in the hope that it will be useful, # -# but WITHOUT ANY WARRANTY; without even the implied warranty of # -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # -# GNU General Public License for more details. # -# # -# You should have received a copy of the GNU General Public License # -# along with this program; if not, write to the Free Software # -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # -################################################################################ - -use lib qw(/usr/lib/libDrakX); -use standalone; # for explanations -use MDK::Common; - -my $run_file = '/var/run/mdkapplet'; - -my $mode = $ARGV[0]; - -if (!-e $run_file) { - # create the stamp file is needed: - open(my $_tmp, '>>', $run_file); -} else { - # exit if we're asked to restart the applets twice in less than 30 seconds - # (eg the trigger script is run by both removed and newly installed packages, - # which can lead to applet crash on SIGHUP because of race condition): - my $mtime = (stat($run_file))[9]; - log::explanations("not restarting the applet (too many restart in a while)"); - exit(0) if time() - $mtime < 30; -} - -if ($mode eq 'new') { - system('killall', '-HUP', 'mdkapplet'); -} else { - #my @lines = `ps -o '$p $u %c'`; - my @lines = `ps -eo pid,user,cmd`; - - # we do not live process ps output in order not to account both old applets and newly started ones: - foreach (@lines) { - my ($pid, $user, $cmd) = /^\s*(\d+)\s*(\S*)\s*(.*)$/; - # do not match su running mdkapplet: - next if $cmd !~ /perl.*mdkapplet/; - my ($DISPLAY) = grep { /^DISPLAY=/ } split('\0', cat_("/proc/$pid/environ")); - $DISPLAY =~ s/^DISPLAY=//; - log::explanations(qq(killing "$cmd" (pid=$pid))); - kill 15, $pid; - my $pid2 = fork(); - if (defined $pid2) { - local $ENV{DISPLAY} = $DISPLAY; - !$pid2 and do { exec('su', $user, '-c', 'mdkapplet --auto-update') or do { require POSIX; POSIX::_exit() } }; - log::explanations("restarting applet (pid=$pid2)"); - } else { - log::explanations(qq(failed to fork Mandriva Online applet for user "$user")); - } - } -} - -my $atime = time(); -utime(($atime) x 2, $run_file); |