summaryrefslogtreecommitdiffstats
path: root/config/chroot_local-includes/usr/local/bin/tails-virt-notify-user
blob: c75a19d2366bc3aeffb4814d434306a926b6aed0 (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
#!/usr/bin/perl

use strict;
use warnings;

#man{{{

=head1 NAME

tails-virt-notify-user

=head1 VERSION

Version X.XX

=head1 AUTHOR

T(A)ILS dev team <amnesia@boum.org>
See https://amnesia.boum.org/.

=cut

#}}}

use Carp;
use Desktop::Notify;
use Fatal qw( open close );
use Locale::gettext;
use POSIX;

### initialization
setlocale(LC_MESSAGES, "");
textdomain("tails-virt-notify-user");
my $detected_virt_file='/var/lib/live/detected-virtual-machine';

### main

exit 0 unless -e $detected_virt_file;

my @detected_virt;

open my $detected_virt_file_h, '<', $detected_virt_file;
while (my $detected_virt = <$detected_virt_file_h>) {
    chomp $detected_virt;
    push @detected_virt, $detected_virt;
}
close $detected_virt_file_h;

exit 0 unless @detected_virt;

my $notify = Desktop::Notify->new();

my $summary = gettext("Warning: virtual machine detected!");
my $body    =
    gettext("Both the host operating system and the virtualization software are able to monitor what you are doing in T(A)ILS.")
    . " "
    . gettext("<a href='file:///live/image/doc/amnesia/wiki/support/virtualization.en.html'>Learn more...</a>");

$notify->create(summary => $summary,
                body => $body,
                timeout => 0)->show();