proxmox-backup/pbs-buildcfg/build.rs
Thomas Lamprecht c650378a39 pbs build config: rust fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-06 16:57:36 +02:00

18 lines
462 B
Rust

// build.rs
use std::env;
use std::process::Command;
fn main() {
let repoid = match env::var("REPOID") {
Ok(repoid) => repoid,
Err(_) => match Command::new("git").args(&["rev-parse", "HEAD"]).output() {
Ok(output) => String::from_utf8(output.stdout).unwrap(),
Err(err) => {
panic!("git rev-parse failed: {}", err);
}
},
};
println!("cargo:rustc-env=REPOID={}", repoid);
}