summaryrefslogtreecommitdiffstats
path: root/draksnapshot-applet
diff options
context:
space:
mode:
Diffstat (limited to 'draksnapshot-applet')
-rwxr-xr-xdraksnapshot-applet43
1 files changed, 38 insertions, 5 deletions
diff --git a/draksnapshot-applet b/draksnapshot-applet
index ce95772..7ffe75e 100755
--- a/draksnapshot-applet
+++ b/draksnapshot-applet
@@ -56,7 +56,7 @@ my %state = (
},
disk_found => {
menu => [ 'configure' ],
- tt => [ N_("USB discs are availlable for backups") ]
+ tt => [ N_("USB discs are available for backups") ]
},
config_in_progress => {
menu => [],
@@ -96,7 +96,22 @@ Gtk2->main;
ugtk2::exit(0);
-my $config_pid;
+my ($config_pid, $checker_pid);
+
+
+my %comm_codes = (
+ discs => {
+ code => 2,
+ status => 'locked',
+ log => N_("urpmi database locked") . ", skipping updating urpmi database",
+ },
+ nothing => {
+ code => 3,
+ status => 'critical',
+ log => N_("Error updating media"),
+ },
+);
+
# Signal management
sub harvester {
@@ -111,6 +126,14 @@ sub harvester {
# we should better check it has really been configured indeed.
setAutoStart('FALSE');
ugtk2::exit(0);
+ } elsif ($checker_pid && $checker_pid == $childpid) {
+ undef $checker_pid;
+ my $status = $? >> 8;
+ my ($state) = grep { $_->{code} eq $status } values %comm_codes;
+ if ($state) {
+ logIt($state->{log});
+ go2State($state->{status});
+ }
}
push @pids, $childpid;
WIFEXITED($?) and refresh_gui(1);
@@ -145,9 +168,19 @@ sub silentCheck() {
my $w = $::main_window ? $::main_window->window : undef;
gtkset_mousecursor_wait($w);
- # force refreshing cache:
- detect_devices::probeall_update_cache();
- @discs = grep { $_->{usb_bus} && detect_devices::may_be_a_hd($_) } detect_devices::getSCSI();
+ $checker_pid = fork();
+ if (defined $checker_pid) {
+ return if $checker_pid; # parent
+
+ # immediate exit, else forked gtk+ object destructors will badly catch up parent applet
+ my $_safe = before_leaving { POSIX::_exit(0) };
+
+ # force refreshing cache:
+
+ detect_devices::probeall_update_cache();
+ @discs = grep { $_->{usb_bus} && detect_devices::may_be_a_hd($_) } detect_devices::getSCSI();
+ }
+
go2State('okay') if !@discs;
# are there any updates ?