From b69b8af26b2a01b2bc45a3aac758ca98a26d56ef Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Mon, 10 Feb 2020 14:43:26 +0100 Subject: [PATCH] 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 --- Makefile | 5 +++-- debian/proxmox-backup-server.install | 4 ++-- etc/Makefile | 4 ++-- ...rvice => proxmox-backup-banner.service.in} | 4 ++-- ...{pbsbanner.rs => proxmox-backup-banner.rs} | 20 +++++++++++-------- 5 files changed, 21 insertions(+), 16 deletions(-) rename etc/{pbsbanner.service => proxmox-backup-banner.service.in} (65%) rename src/bin/{pbsbanner.rs => proxmox-backup-banner.rs} (69%) diff --git a/Makefile b/Makefile index 1d6a34f9..7c58a956 100644 --- a/Makefile +++ b/Makefile @@ -12,12 +12,13 @@ USR_BIN := \ pxar # Binaries usable by admins -USR_SBIN := proxmox-backup-manager \ - pbsbanner +USR_SBIN := \ + proxmox-backup-manager # Binaries for services: SERVICE_BIN := \ proxmox-backup-api \ + proxmox-backup-banner \ proxmox-backup-proxy ifeq ($(BUILD_MODE), release) diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install index f5a94f51..8df7b5b4 100644 --- a/debian/proxmox-backup-server.install +++ b/debian/proxmox-backup-server.install @@ -1,10 +1,10 @@ etc/proxmox-backup-proxy.service /lib/systemd/system/ etc/proxmox-backup.service /lib/systemd/system/ -etc/pbsbanner.service /lib/systemd/system/ +etc/proxmox-backup-banner.service /lib/systemd/system/ usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy +usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-banner usr/sbin/proxmox-backup-manager -usr/sbin/pbsbanner usr/share/javascript/proxmox-backup/css/ext6-pbs.css usr/share/javascript/proxmox-backup/images/logo-128.png usr/share/javascript/proxmox-backup/images/proxmox_logo.png diff --git a/etc/Makefile b/etc/Makefile index 93d0c731..5147318d 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,9 +1,9 @@ include ../defines.mk -UNITS := \ - pbsbanner.service \ +UNITS := DYNAMIC_UNITS := \ + proxmox-backup-banner.service \ proxmox-backup.service \ proxmox-backup-proxy.service diff --git a/etc/pbsbanner.service b/etc/proxmox-backup-banner.service.in similarity index 65% rename from etc/pbsbanner.service rename to etc/proxmox-backup-banner.service.in index c2849560..d141a906 100644 --- a/etc/pbsbanner.service +++ b/etc/proxmox-backup-banner.service.in @@ -1,13 +1,13 @@ [Unit] Description=Proxmox Backup Server Login Banner -ConditionPathExists=/usr/sbin/pbsbanner +ConditionPathExists=%LIBEXECDIR%/proxmox-backup/proxmox-backup-banner ConditionPathExists=!/usr/bin/pvebanner DefaultDependencies=no After=local-fs.target Before=console-getty.service [Service] -ExecStart=/usr/sbin/pbsbanner +ExecStart=%LIBEXECDIR%/proxmox-backup/proxmox-backup-banner Type=oneshot RemainAfterExit=yes diff --git a/src/bin/pbsbanner.rs b/src/bin/proxmox-backup-banner.rs similarity index 69% rename from src/bin/pbsbanner.rs rename to src/bin/proxmox-backup-banner.rs index 6bccfe1d..ad9ef259 100644 --- a/src/bin/pbsbanner.rs +++ b/src/bin/proxmox-backup-banner.rs @@ -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;