5
0
mirror of git://git.proxmox.com/git/proxmox-backup-restore-image.git synced 2025-01-31 09:47:00 +03:00

init shim: print package version

use the one from the debian package, as that's what we actually track
but fall back to the cargo one from the init shim (which we normally
don't bump) for developer convenience (env! fails the build if the
variable isn't set).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2023-04-12 12:29:38 +02:00
parent ea328f216c
commit 175f8d975b

View File

@ -16,7 +16,8 @@ const NULL_MIN: u64 = 3;
///
/// This is supposed to run as /init in an initramfs image.
fn main() {
println!("[init-shim] beginning user space setup");
let version = get_restore_image_version();
println!("[init-shim] beginning user space setup, version {version}");
// /dev is mounted automatically
wrap_err("mount /sys", || do_mount("/sys", "sysfs"));
@ -42,6 +43,13 @@ fn main() {
do_run("/proxmox-restore-daemon");
}
const fn get_restore_image_version() -> &'static str {
match option_env!("DEB_VERSION") {
Some(deb_version) => deb_version,
None => env!("CARGO_PKG_VERSION"),
}
}
fn run_agetty() -> Result<(), Error> {
use nix::unistd::{fork, ForkResult};