summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/usr/local/lib/tails-i2p-removal-notify-user
blob: 25408c43c46f8c5bdc508899a2122f85d4a89140 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl

use strict;
use warnings;

#man{{{

=head1 NAME

tails-i2p-removal-notify-user

=head1 VERSION

Version X.XX

=head1 AUTHOR

Tails dev team <amnesia@boum.org>
See https://tails.boum.org/.

=cut

#}}}

use Desktop::Notify;
use English '-no_match_vars';
use Locale::gettext;
use Net::DBus::Reactor;
use POSIX;

### initialization
setlocale(LC_MESSAGES, "");
textdomain("tails");

### callbacks

sub action_cb {
    my $reactor = shift;
    unless (fork) {
        exec(
            '/usr/local/bin/tails-documentation',
            'doc/anonymous_internet/i2p',
            'removal',
        );
    }
    $reactor->shutdown;
}

### main

my $reactor = Net::DBus::Reactor->main;

my $notify  = Desktop::Notify->new();
$notify->action_callback(sub { action_cb($reactor, @_) });
$notify->close_callback(sub { $reactor->shutdown; });

my $summary = gettext("Warning: I2P will be removed in Tails 2.12");
$notify->create(summary => $summary,
                actions => { "moreinfo_$PID" => gettext('Learn more'), },
                hints   => { 'transient' => 1, },
                timeout => 0)->show();

$reactor->run;