Merge remote-tracking branch 'flapflap/de-network_configuration'
[tails-test.git] / config / chroot_local-includes / usr / local / bin / tails-virt-notify-user
blobef616836146d2e881233edfda34e6b810e33b672
1 #!/usr/bin/perl
3 use strict;
4 use warnings;
6 #man{{{
8 =head1 NAME
10 tails-virt-notify-user
12 =head1 VERSION
14 Version X.XX
16 =head1 AUTHOR
18 Tails dev team <amnesia@boum.org>
19 See https://tails.boum.org/.
21 =cut
23 #}}}
25 use Carp;
26 use Desktop::Notify;
27 use Fatal qw( open close );
28 use Locale::gettext;
29 use POSIX;
31 ### initialization
32 setlocale(LC_MESSAGES, "");
33 textdomain("tails");
34 my $detected_virt_file='/var/lib/live/detected-virtual-machine';
36 ### main
38 exit 0 unless -e $detected_virt_file;
40 my @detected_virt;
42 open my $detected_virt_file_h, '<', $detected_virt_file;
43 while (my $detected_virt = <$detected_virt_file_h>) {
44 chomp $detected_virt;
45 push @detected_virt, $detected_virt;
47 close $detected_virt_file_h;
49 exit 0 unless @detected_virt;
51 my $notify = Desktop::Notify->new();
53 my $summary = gettext("Warning: virtual machine detected!");
54 my $body =
55 gettext("Both the host operating system and the virtualization software are able to monitor what you are doing in Tails.")
56 . " "
57 . gettext("<a href='file:///usr/share/doc/tails/website/doc/advanced_topics/virtualization.en.html#security'>Learn more...</a>")
58 . " "; # Workaround: else the last line of the notification is not displayed
60 $notify->create(summary => $summary,
61 body => $body,
62 timeout => 0)->show();