public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/3] pbs3to4: use boolean variable for systemd-boot installation state
Date: Mon, 18 Aug 2025 21:40:25 +0200	[thread overview]
Message-ID: <20250818194026.840749-3-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20250818194026.840749-1-s.ivanov@proxmox.com>

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@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



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  parent reply	other threads:[~2025-08-18 19:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-18 19:40 [pbs-devel] [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov
2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 1/3] pbs3to4: fix logic error and typo in log message Stoiko Ivanov
2025-08-18 19:40 ` Stoiko Ivanov [this message]
2025-08-18 19:40 ` [pbs-devel] [PATCH proxmox-backup 3/3] pbs3to4: bootloader: only allow systemd-boot before upgrade when used Stoiko Ivanov
2025-08-21 14:18 ` [pbs-devel] superseded: [PATCH proxmox-backup 0/3] pbs3to4: rework bootloader checks Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250818194026.840749-3-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal