Tweak pvebanner to add FQDN to /etc/issue

binutils

Member
Mar 10, 2023
1
0
6
5a6
> use PVE::Tools;
8a10
> my $cached_fqdn = PVE::Tools::get_fqdn($nodename);
20a23,24
>
> https://${cached_fqdn}:8006/
root@proxmox100:~# diff pvebanner-old pvebanner-new
5a6
> use PVE::Tools;
8a10
> my $cached_fqdn = PVE::Tools::get_fqdn($nodename);
20a23,24
>
> https://${cached_fqdn}:8006/


Bash:
#!/usr/bin/perl

use strict;
use PVE::INotify;
use PVE::Cluster;
use PVE::Tools;

my $nodename = PVE::INotify::nodename();
my $localip = PVE::Cluster::remote_node_ip($nodename, 1);
my $cached_fqdn = PVE::Tools::get_fqdn($nodename);

my $xline = '-' x 78;

my $banner = '';

if ($localip) {
    $banner .= <<__EOBANNER;

$xline

Welcome to the Proxmox Virtual Environment. Please use your web browser to
configure this server - connect to:

  https://${cached_fqdn}:8006/

  https://${localip}:8006/

$xline

__EOBANNER

}

open(ISSUE, ">/etc/issue");

print ISSUE $banner;

close(ISSUE);

exit(0);