mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
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:
@@ -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)) =
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user