2021-09-21 10:11:14 +00:00
|
|
|
use proxmox::api::{
|
|
|
|
cli::{run_cli_command, CliCommandMap, CliEnvironment},
|
|
|
|
RpcEnvironment,
|
|
|
|
};
|
2021-08-31 12:45:48 +00:00
|
|
|
|
2021-09-21 10:11:13 +00:00
|
|
|
mod proxmox_backup_debug;
|
|
|
|
use proxmox_backup_debug::*;
|
2021-08-31 12:45:48 +00:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let cmd_def = CliCommandMap::new()
|
|
|
|
.insert("inspect", inspect::inspect_commands())
|
2021-09-21 10:11:14 +00:00
|
|
|
.insert("recover", recover::recover_commands())
|
|
|
|
.insert("api", api::api_commands());
|
|
|
|
|
|
|
|
let uid = nix::unistd::Uid::current();
|
|
|
|
let username = match nix::unistd::User::from_uid(uid) {
|
|
|
|
Ok(Some(user)) => user.name,
|
|
|
|
_ => "root@pam".to_string(),
|
|
|
|
};
|
|
|
|
let mut rpcenv = CliEnvironment::new();
|
|
|
|
rpcenv.set_auth_id(Some(format!("{}@pam", username)));
|
2021-08-31 12:45:48 +00:00
|
|
|
|
|
|
|
run_cli_command(cmd_def, rpcenv, Some(|future| pbs_runtime::main(future)));
|
|
|
|
}
|