From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>
Cc: Kamil Trzcinski <ayufan@ayufan.eu>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] buildsys: make the build multi-arch
Date: Wed, 03 Sep 2025 10:58:37 +0200 [thread overview]
Message-ID: <1756888500.fn9sqjfb0t.astroid@yuna.none> (raw)
In-Reply-To: <20250811090628.184607-1-ayufan@ayufan.eu>
hi!
thanks for this patch, some comments below to make this simpler/easier
to maintain going forward..
On August 11, 2025 11:06 am, Kamil Trzcinski wrote:
> - fixes debian .install scripts to be `dh-exec`
> - fixes hardcoded .rs paths to be platform-dependent
> - fixes postinst to deduce architecture
>
> Signed-off-by: Kamil Trzcinski <ayufan@ayufan.eu>
> ---
> debian/proxmox-backup-file-restore.install | 3 ++-
> debian/proxmox-backup-file-restore.postinst | 10 +++++++++-
> debian/proxmox-backup-server.install | 11 ++++++-----
> debian/rules | 1 +
> pbs-buildcfg/src/lib.rs | 9 +++++++++
> src/tape/drive/lto/mod.rs | 9 +++++++--
> 6 files changed, 34 insertions(+), 9 deletions(-)
> mode change 100644 => 100755 debian/proxmox-backup-file-restore.install
> mode change 100644 => 100755 debian/proxmox-backup-server.install
>
> diff --git a/debian/proxmox-backup-file-restore.install b/debian/proxmox-backup-file-restore.install
> old mode 100644
> new mode 100755
> index 409988a3..8b4034bd
> --- a/debian/proxmox-backup-file-restore.install
> +++ b/debian/proxmox-backup-file-restore.install
> @@ -1,4 +1,5 @@
> +#! /usr/bin/dh-exec
> usr/bin/proxmox-file-restore
> -usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore/proxmox-restore-daemon
> +usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/file-restore/proxmox-restore-daemon
this can instead use a * wildcard, since the package build should never
install for more than one architecture anyway..
> usr/share/man/man1/proxmox-file-restore.1
> usr/share/zsh/vendor-completions/_proxmox-file-restore
> diff --git a/debian/proxmox-backup-file-restore.postinst b/debian/proxmox-backup-file-restore.postinst
> index c73893dd..86faf43a 100755
> --- a/debian/proxmox-backup-file-restore.postinst
> +++ b/debian/proxmox-backup-file-restore.postinst
> @@ -3,8 +3,16 @@
> set -e
>
> update_initramfs() {
> + case "$(dpkg --print-architecture)" in
this is already available in $DPKG_MAINTSCRIPT_ARCH
> + amd64) INST_PATH="/usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore" ;;
> + arm64) INST_PATH="/usr/lib/aarch64-linux-gnu/proxmox-backup/file-restore" ;;
> + *)
> + echo "proxmox-backup-file-restore: architecture not supported, skipping update." >&2
> + exit 0
> + ;;
> + esac
> +
> # regenerate initramfs for single file restore VM
> - INST_PATH="/usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore"
> CACHE_PATH="/var/cache/proxmox-backup/file-restore-initramfs.img"
> CACHE_PATH_DBG="/var/cache/proxmox-backup/file-restore-initramfs-debug.img"
>
> diff --git a/debian/proxmox-backup-server.install b/debian/proxmox-backup-server.install
> old mode 100644
> new mode 100755
> index d06f026c..f305af37
> --- a/debian/proxmox-backup-server.install
> +++ b/debian/proxmox-backup-server.install
> @@ -1,3 +1,4 @@
> +#! /usr/bin/dh-exec
> etc/pbs-enterprise.sources /etc/apt/sources.list.d/
> etc/pbs-network-config-commit.service /usr/lib/systemd/system/
> etc/proxmox-backup-banner.service /usr/lib/systemd/system/
> @@ -9,11 +10,11 @@ etc/removable-device-attach@.service /usr/lib/systemd/system/
> usr/bin/pmt
> usr/bin/pmtx
> usr/bin/proxmox-tape
> -usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api
> -usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-banner
> -usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy
> -usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-daily-update
> -usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd
> +usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-api
> +usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-banner
> +usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-backup-proxy
> +usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/proxmox-daily-update
> +usr/lib/${DEB_HOST_MULTIARCH}/proxmox-backup/sg-tape-cmd
same as above
> usr/sbin/pbs3to4
> usr/sbin/proxmox-backup-debug
> usr/sbin/proxmox-backup-manager
> diff --git a/debian/rules b/debian/rules
> index ab48cce1..a5419da7 100755
> --- a/debian/rules
> +++ b/debian/rules
> @@ -2,6 +2,7 @@
> # See debhelper(7) (uncomment to enable)
> # output every command that modifies files on the build system.
> DH_VERBOSE = 1
> +DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
and then this could be skipped
>
> include /usr/share/dpkg/pkg-info.mk
> include /usr/share/rustc/architecture.mk
> diff --git a/pbs-buildcfg/src/lib.rs b/pbs-buildcfg/src/lib.rs
> index 3d087015..793d4cfd 100644
> --- a/pbs-buildcfg/src/lib.rs
> +++ b/pbs-buildcfg/src/lib.rs
> @@ -52,12 +52,21 @@ macro_rules! PROXMOX_BACKUP_CACHE_DIR_M {
> }
>
> #[macro_export]
> +#[cfg(target_arch = "x86_64")]
> macro_rules! PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M {
> () => {
> "/usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore"
> };
> }
>
> +#[macro_export]
> +#[cfg(target_arch = "aarch64")]
> +macro_rules! PROXMOX_BACKUP_FILE_RESTORE_BIN_DIR_M {
> + () => {
> + "/usr/lib/aarch64-linux-gnu/proxmox-backup/file-restore"
> + };
> +}
> +
> /// namespaced directory for in-memory (tmpfs) run state
> pub const PROXMOX_BACKUP_RUN_DIR: &str = PROXMOX_BACKUP_RUN_DIR_M!();
>
> diff --git a/src/tape/drive/lto/mod.rs b/src/tape/drive/lto/mod.rs
> index bd5ec8ae..0df15933 100644
> --- a/src/tape/drive/lto/mod.rs
> +++ b/src/tape/drive/lto/mod.rs
> @@ -284,9 +284,14 @@ impl TapeDriver for LtoTapeHandle {
> }
> }
>
> +#[cfg(target_arch = "x86_64")]
> +const SG_TAPE_PATH: &str = "/usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd";
> +
> +#[cfg(target_arch = "aarch64")]
> +const SG_TAPE_PATH: &str = "/usr/lib/aarch64-linux-gnu/proxmox-backup/sg-tape-cmd";
we could move the base dir to buildcfg above, then we only need a single
#cfg-ed definition instead of repeating it for all paths..
> +
> fn run_sg_tape_cmd(subcmd: &str, args: &[&str], fd: RawFd) -> Result<String, Error> {
> - let mut command =
> - std::process::Command::new("/usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd");
> + let mut command = std::process::Command::new(SG_TAPE_PATH);
> command.args([subcmd]);
> command.args(["--stdin"]);
> command.args(args);
> --
> 2.47.2
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
>
>
>
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
prev parent reply other threads:[~2025-09-03 8:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 9:06 Kamil Trzcinski
2025-09-03 8:58 ` Fabian Grünbichler [this message]
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=1756888500.fn9sqjfb0t.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=ayufan@ayufan.eu \
--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