X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=src%2Fbin%2Fproxmox-backup-client.rs;h=7d4f28fa6ccac74be1c8d19e8cc071634b9a87dd;hb=067fe514e608950f1d1cf66fa27997b54beff467;hp=8c5d060a2b58bc9d5947eef09906503b273d0b9f;hpb=1e8da0a789038a47754dfc490ef72de9ae688f6e;p=proxmox-backup.git diff --git a/src/bin/proxmox-backup-client.rs b/src/bin/proxmox-backup-client.rs index 8c5d060a..7d4f28fa 100644 --- a/src/bin/proxmox-backup-client.rs +++ b/src/bin/proxmox-backup-client.rs @@ -1,56 +1,76 @@ -use failure::*; -use nix::unistd::{fork, ForkResult, pipe}; -use std::os::unix::io::RawFd; -use chrono::{Local, Utc, TimeZone}; -use std::path::{Path, PathBuf}; use std::collections::{HashSet, HashMap}; -use std::ffi::OsStr; -use std::io::{Write, Seek, SeekFrom}; -use std::os::unix::fs::OpenOptionsExt; +use std::convert::TryFrom; +use std::io::{self, Read, Write, Seek, SeekFrom}; +use std::os::unix::io::{FromRawFd, RawFd}; +use std::path::{Path, PathBuf}; +use std::pin::Pin; +use std::sync::{Arc, Mutex}; +use std::task::Context; + +use anyhow::{bail, format_err, Error}; +use chrono::{Local, DateTime, Utc, TimeZone}; +use futures::future::FutureExt; +use futures::stream::{StreamExt, TryStreamExt}; +use serde_json::{json, Value}; +use tokio::sync::mpsc; +use xdg::BaseDirectories; -use proxmox::{sortable, identity}; +use pathpatterns::{MatchEntry, MatchType, PatternFlag}; use proxmox::tools::fs::{file_get_contents, file_get_json, replace_file, CreateOptions, image_size}; use proxmox::api::{ApiHandler, ApiMethod, RpcEnvironment}; use proxmox::api::schema::*; use proxmox::api::cli::*; use proxmox::api::api; +use pxar::accessor::{MaybeReady, ReadAt, ReadAtOperation}; use proxmox_backup::tools; use proxmox_backup::api2::types::*; use proxmox_backup::client::*; -use proxmox_backup::backup::*; -use proxmox_backup::pxar::{ self, catalog::* }; - -//use proxmox_backup::backup::image_index::*; -//use proxmox_backup::config::datastore; -//use proxmox_backup::pxar::encoder::*; -//use proxmox_backup::backup::datastore::*; - -use serde_json::{json, Value}; -//use hyper::Body; -use std::sync::{Arc, Mutex}; -//use regex::Regex; -use xdg::BaseDirectories; - -use futures::*; -use tokio::sync::mpsc; - -proxmox::api::const_regex! { - BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(?:pxar|img|conf|log)):(.+)$"; -} - -const REPO_URL_SCHEMA: Schema = StringSchema::new("Repository URL.") +use proxmox_backup::pxar::catalog::*; +use proxmox_backup::backup::{ + archive_type, + decrypt_key, + verify_chunk_size, + ArchiveType, + AsyncReadChunk, + BackupDir, + BackupGroup, + BackupManifest, + BufferedDynamicReader, + CATALOG_NAME, + CatalogReader, + CatalogWriter, + ChunkStream, + CryptConfig, + CryptMode, + DataBlob, + DynamicIndexReader, + FixedChunkStream, + FixedIndexReader, + IndexFile, + MANIFEST_BLOB_NAME, + Shell, +}; + +mod proxmox_backup_client; +use proxmox_backup_client::*; + +const ENV_VAR_PBS_FINGERPRINT: &str = "PBS_FINGERPRINT"; +const ENV_VAR_PBS_PASSWORD: &str = "PBS_PASSWORD"; + + +pub const REPO_URL_SCHEMA: Schema = StringSchema::new("Repository URL.") .format(&BACKUP_REPO_URL) .max_length(256) .schema(); -const BACKUP_SOURCE_SCHEMA: Schema = StringSchema::new( - "Backup source specification ([