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
|
#!/usr/bin/env perl
use strict;
use warnings;
use Sys::Hostname;
# debug
use Data::Dumper;
use constant {
BROWSER => '/bin/firefox',
HOSTNAME => (split /\./, hostname())[0]
};
use constant LIST => {
graf => 'http://graf.joe.town/',
zhinu => 'https://zhinu.jozan.org/',
nua_grafana => 'https://grafana.nuabee.fr/',
nua_gr_linux_servers => 'https://grafana.nuabee.fr/d/xfpJB9FGz/linux-servers',
nua_gr_restops => 'https://grafana.nuabee.fr/d/Mz11bd07k/vue-d-ensemble-machines-atelier',
nua_git => 'https://gitlab.int.ysosecure.com/',
nua_mbs => 'https://mbs.nuabee.com/',
nua_hedgedoc => 'http://hedgedoc.int.ysosecure.com/',
nua_doc => 'https://doc.int.ysosecure.com/',
nua_kb => 'https://kb.int.ysosecure.com/',
nua_zammad => 'https://support.nuabee.fr/',
nua_atlas => 'https://atlas.nuabee.fr/',
nua_share => 'https://share.nuabee.fr/',
};
sub main
{
my $choice;
my $url;
my $pid;
my $prefix;
my $list;
$prefix = '/usr';
if (HOSTNAME eq "mars") {
$prefix += '/local';
}
for (keys %{LIST()}) {
$list .= $_ . "\n";
}
$choice = `printf "$list" | dmenu -i -m 0 -l 100`;
if (not $choice) {
return;
}
chomp $choice;
$pid = fork();
if (not $pid) {
exec($prefix . BROWSER, LIST->{$choice});
}
return;
}
main();
__END__
|