fix migration to support portable fatties (#1935)

* load docker images directly from s9pk to ensure fatties can be loaded across platform

* don't migrate tmpdir

* init after package data transfer

* set default rsync options
This commit is contained in:
Aiden McClelland
2022-11-10 10:20:26 -07:00
parent ca71c88744
commit 22b273b145
7 changed files with 44 additions and 56 deletions

View File

@@ -16,6 +16,10 @@ pub use byte_replacement_reader::*;
pub use rsync::*;
pub use script_dir::*;
pub fn const_true() -> bool {
true
}
pub fn to_tmp_path(path: impl AsRef<Path>) -> Result<PathBuf, Error> {
let path = path.as_ref();
if let (Some(parent), Some(file_name)) =

View File

@@ -1,7 +1,7 @@
use color_eyre::eyre::eyre;
use std::path::Path;
use crate::{ByteReplacementReader, NonDetachingJoinHandle};
use crate::{const_true, ByteReplacementReader, NonDetachingJoinHandle};
use models::{Error, ErrorKind};
use tokio::io::{AsyncBufReadExt, AsyncReadExt, BufReader};
use tokio::process::{Child, Command};
@@ -11,9 +11,14 @@ use tokio_stream::wrappers::WatchStream;
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct RsyncOptions {
#[serde(default = "const_true")]
pub delete: bool,
#[serde(default = "const_true")]
pub force: bool,
#[serde(default)]
pub ignore_existing: bool,
#[serde(default)]
pub exclude: Vec<String>,
}
impl Default for RsyncOptions {
fn default() -> Self {
@@ -21,6 +26,7 @@ impl Default for RsyncOptions {
delete: true,
force: true,
ignore_existing: false,
exclude: Vec::new(),
}
}
}
@@ -47,6 +53,9 @@ impl Rsync {
if options.ignore_existing {
cmd.arg("--ignore-existing");
}
for exclude in options.exclude {
cmd.arg(format!("--exclude={}", exclude));
}
let mut command = cmd
.arg("-ac")
.arg("--info=progress2")