mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
retry file copies during migration (#1221)
* retry file copies during migration up to 10x * fix build * readonly mounts, and validation on v2 recovery * banish booleans
This commit is contained in:
@@ -26,7 +26,7 @@ use crate::context::RpcContext;
|
||||
use crate::db::model::UpdateProgress;
|
||||
use crate::db::util::WithRevision;
|
||||
use crate::disk::mount::filesystem::block_dev::BlockDev;
|
||||
use crate::disk::mount::filesystem::FileSystem;
|
||||
use crate::disk::mount::filesystem::{FileSystem, ReadWrite};
|
||||
use crate::disk::mount::guard::TmpMountGuard;
|
||||
use crate::disk::BOOT_RW_PATH;
|
||||
use crate::notifications::NotificationLevel;
|
||||
@@ -114,12 +114,6 @@ impl WritableDrives {
|
||||
fn as_fs(&self) -> impl FileSystem {
|
||||
BlockDev::new(self.block_dev())
|
||||
}
|
||||
fn invert(&self) -> WritableDrives {
|
||||
match self {
|
||||
Self::Green => Self::Blue,
|
||||
Self::Blue => Self::Green,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This will be where we are going to be putting the new update
|
||||
@@ -393,14 +387,14 @@ async fn check_download(hash_from_header: &str, file_digest: Vec<u8>) -> Result<
|
||||
}
|
||||
|
||||
async fn copy_machine_id(new_label: NewLabel) -> Result<(), Error> {
|
||||
let new_guard = TmpMountGuard::mount(&new_label.0.as_fs()).await?;
|
||||
let new_guard = TmpMountGuard::mount(&new_label.0.as_fs(), ReadWrite).await?;
|
||||
tokio::fs::copy("/etc/machine-id", new_guard.as_ref().join("etc/machine-id")).await?;
|
||||
new_guard.unmount().await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn copy_ssh_host_keys(new_label: NewLabel) -> Result<(), Error> {
|
||||
let new_guard = TmpMountGuard::mount(&new_label.0.as_fs()).await?;
|
||||
let new_guard = TmpMountGuard::mount(&new_label.0.as_fs(), ReadWrite).await?;
|
||||
tokio::fs::copy(
|
||||
"/etc/ssh/ssh_host_rsa_key",
|
||||
new_guard.as_ref().join("etc/ssh/ssh_host_rsa_key"),
|
||||
@@ -443,7 +437,7 @@ async fn swap_boot_label(new_label: NewLabel) -> Result<(), Error> {
|
||||
.arg(new_label.0.label())
|
||||
.invoke(crate::ErrorKind::BlockDevice)
|
||||
.await?;
|
||||
let mounted = TmpMountGuard::mount(&new_label.0.as_fs()).await?;
|
||||
let mounted = TmpMountGuard::mount(&new_label.0.as_fs(), ReadWrite).await?;
|
||||
Command::new("sed")
|
||||
.arg("-i")
|
||||
.arg(&format!(
|
||||
|
||||
Reference in New Issue
Block a user