[pbs-devel] [PATCH proxmox-backup 2/3] pbs3to4: use boolean variable for systemd-boot installation state

Stoiko Ivanov s.ivanov at proxmox.com
Mon Aug 18 21:40:25 CEST 2025


while it's not saving too much run-time wise (each branch stats the
file only once), it's a bit easier to read.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/bin/pbs3to4.rs | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/bin/pbs3to4.rs b/src/bin/pbs3to4.rs
index 5df960a3..e700c832 100644
--- a/src/bin/pbs3to4.rs
+++ b/src/bin/pbs3to4.rs
@@ -206,8 +206,10 @@ impl Checker {
         self.output
             .log_info("Checking bootloader configuration...")?;
 
+        let sd_boot_installed = Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file();
+
         if !Path::new("/sys/firmware/efi").is_dir() {
-            if Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
+            if sd_boot_installed {
                 self.output.log_info(
                     "systemd-boot package installed on legacy-boot system is not \
                     necessary, consider removing it",
@@ -227,7 +229,7 @@ impl Checker {
                     .log_skip("not yet upgraded, systemd-boot still needed for bootctl")?;
                 return Ok(());
             }
-            if Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
+            if sd_boot_installed {
                 self.output.log_fail(
                     "systemd-boot meta-package installed. This will cause issues on upgrades of \
                     boot-related packages.\n\
@@ -237,7 +239,7 @@ impl Checker {
                 return Ok(());
             }
         } else {
-            if Path::new("/usr/share/doc/systemd-boot/changelog.Debian.gz").is_file() {
+            if sd_boot_installed {
                 self.output.log_fail(
                     "systemd-boot meta-package installed. This will cause problems on upgrades of other \
                     boot-related packages.\n\
-- 
2.39.5





More information about the pbs-devel mailing list