]> git.proxmox.com Git - proxmox-backup.git/commitdiff
restore daemon: add setup_system_env helper
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 23 Jul 2021 06:10:55 +0000 (08:10 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 23 Jul 2021 06:10:55 +0000 (08:10 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/bin/proxmox-restore-daemon.rs

index ebe8cef52568c022610cccaf0cb8ff892eac68dd..5456bd23293ba1c1f4e56bb64e1c5f630a4c00f4 100644 (file)
@@ -50,9 +50,7 @@ fn main() -> Result<(), Error> {
         .format_timestamp_millis()
         .init();
 
-    // the API may save some stuff there, e.g., the memcon tracking file
-    // we do not care much, but it's way less headache to just create it
-    std::fs::create_dir_all("/run/proxmox-backup")?;
+    setup_system_env()?;
 
     // scan all attached disks now, before starting the API
     // this will panic and stop the VM if anything goes wrong
@@ -66,6 +64,15 @@ fn main() -> Result<(), Error> {
     pbs_runtime::main(run())
 }
 
+/// ensure we have our /run dirs, system users and stuff like that setup
+fn setup_system_env() -> Result<(), Error> {
+    // the API may save some stuff there, e.g., the memcon tracking file
+    // we do not care much, but it's way less headache to just create it
+    std::fs::create_dir_all("/run/proxmox-backup")?;
+
+    Ok(())
+}
+
 async fn run() -> Result<(), Error> {
     watchdog_init();