s/pbsbanner/proxmox-backup-banner/ + move to /usr/lib

We want to avoid pbs if possible and also avoid placing internal
binaries, not intended for human direct use, in /bin or /sbin paths.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2020-02-10 14:43:26 +01:00
parent e2b5e75a3e
commit b69b8af26b
5 changed files with 21 additions and 16 deletions

View File

@ -8,7 +8,8 @@ fn main() {
let nodename = tools::nodename();
let addr = format!("{}:8007", nodename);
let mut banner = format!("
let mut banner = format!(
"
{:-<78}
Welcome to the Proxmox Backup Server. Please use your web browser to
@ -21,18 +22,21 @@ configure this server - connect to:
let msg = match addr.to_socket_addrs() {
Ok(saddrs) => {
let saddrs: Vec<_> = saddrs
.filter_map(|s| match !s.ip().is_loopback() {
true => Some(format!(" https://{}/", s)),
false => None,
})
.collect();
.filter_map(|s| match !s.ip().is_loopback() {
true => Some(format!(" https://{}/", s)),
false => None,
})
.collect();
if !saddrs.is_empty() {
saddrs.join("\n")
} else {
format!("hostname '{}' does not resolves to any non-loopback address", nodename)
format!(
"hostname '{}' does not resolves to any non-loopback address",
nodename
)
}
},
}
Err(e) => format!("could not resolve hostname '{}': {}", nodename, e),
};
banner += &msg;