pxar: add functionality to pass exclude MatchPatterns on create

This exposes the option to pass a list of exclude MatchPattern via the
'--exclude' option.
The list is encoded as file '.pxarexclude-cli' in the archives root directory.
If such a file is present in the filesystem, it is skipped and not included in
the archive in order to avoid conflicting information.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner
2019-10-22 15:07:51 +02:00
committed by Dietmar Maurer
parent ba8165c607
commit 62d123e50a
4 changed files with 89 additions and 6 deletions

View File

@ -59,10 +59,21 @@ impl PxarBackupStream {
let error2 = error.clone();
let catalog = catalog.clone();
let exclude_pattern = Vec::new();
let child = thread::spawn(move || {
let mut guard = catalog.lock().unwrap();
let mut writer = unsafe { std::fs::File::from_raw_fd(tx) };
if let Err(err) = pxar::Encoder::encode(path, &mut dir, &mut writer, Some(&mut *guard), device_set, verbose, skip_lost_and_found, pxar::flags::DEFAULT) {
if let Err(err) = pxar::Encoder::encode(
path,
&mut dir,
&mut writer,
Some(&mut *guard),
device_set,
verbose,
skip_lost_and_found,
pxar::flags::DEFAULT,
exclude_pattern,
) {
let mut error = error2.lock().unwrap();
*error = Some(err.to_string());
}