mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
actually address warning instead of muting it like a sociopath
This commit is contained in:
committed by
Keagan McClelland
parent
b7e86bf556
commit
7b4d657a2d
@@ -79,7 +79,7 @@ async fn setup_or_init(cfg_path: Option<&str>) -> Result<(), Error> {
|
|||||||
let guid_string = tokio::fs::read_to_string("/embassy-os/disk.guid") // unique identifier for volume group - keeps track of the disk that goes with your embassy
|
let guid_string = tokio::fs::read_to_string("/embassy-os/disk.guid") // unique identifier for volume group - keeps track of the disk that goes with your embassy
|
||||||
.await?;
|
.await?;
|
||||||
let guid = guid_string.trim();
|
let guid = guid_string.trim();
|
||||||
let reboot = embassy::disk::main::import(
|
let requires_reboot = embassy::disk::main::import(
|
||||||
guid,
|
guid,
|
||||||
cfg.datadir(),
|
cfg.datadir(),
|
||||||
if tokio::fs::metadata(REPAIR_DISK_PATH).await.is_ok() {
|
if tokio::fs::metadata(REPAIR_DISK_PATH).await.is_ok() {
|
||||||
@@ -95,7 +95,7 @@ async fn setup_or_init(cfg_path: Option<&str>) -> Result<(), Error> {
|
|||||||
.await
|
.await
|
||||||
.with_ctx(|_| (embassy::ErrorKind::Filesystem, REPAIR_DISK_PATH))?;
|
.with_ctx(|_| (embassy::ErrorKind::Filesystem, REPAIR_DISK_PATH))?;
|
||||||
}
|
}
|
||||||
if reboot.0 {
|
if requires_reboot.0 {
|
||||||
embassy::disk::main::export(guid, cfg.datadir()).await?;
|
embassy::disk::main::export(guid, cfg.datadir()).await?;
|
||||||
Command::new("reboot")
|
Command::new("reboot")
|
||||||
.invoke(embassy::ErrorKind::Unknown)
|
.invoke(embassy::ErrorKind::Unknown)
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ use crate::disk::mount::filesystem::cifs::Cifs;
|
|||||||
use crate::disk::mount::filesystem::ReadOnly;
|
use crate::disk::mount::filesystem::ReadOnly;
|
||||||
use crate::disk::mount::guard::TmpMountGuard;
|
use crate::disk::mount::guard::TmpMountGuard;
|
||||||
use crate::disk::util::{pvscan, recovery_info, DiskListResponse, EmbassyOsRecoveryInfo};
|
use crate::disk::util::{pvscan, recovery_info, DiskListResponse, EmbassyOsRecoveryInfo};
|
||||||
|
use crate::disk::REPAIR_DISK_PATH;
|
||||||
use crate::hostname::PRODUCT_KEY_PATH;
|
use crate::hostname::PRODUCT_KEY_PATH;
|
||||||
use crate::id::Id;
|
use crate::id::Id;
|
||||||
use crate::init::init;
|
use crate::init::init;
|
||||||
@@ -95,13 +96,31 @@ pub async fn attach(
|
|||||||
#[context] ctx: SetupContext,
|
#[context] ctx: SetupContext,
|
||||||
#[arg] guid: Arc<String>,
|
#[arg] guid: Arc<String>,
|
||||||
) -> Result<SetupResult, Error> {
|
) -> Result<SetupResult, Error> {
|
||||||
let _ = crate::disk::main::import(
|
let requires_reboot = crate::disk::main::import(
|
||||||
&*guid,
|
&*guid,
|
||||||
&ctx.datadir,
|
&ctx.datadir,
|
||||||
RepairStrategy::Preen,
|
if tokio::fs::metadata(REPAIR_DISK_PATH).await.is_ok() {
|
||||||
|
RepairStrategy::Aggressive
|
||||||
|
} else {
|
||||||
|
RepairStrategy::Preen
|
||||||
|
},
|
||||||
DEFAULT_PASSWORD,
|
DEFAULT_PASSWORD,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
if tokio::fs::metadata(REPAIR_DISK_PATH).await.is_ok() {
|
||||||
|
tokio::fs::remove_file(REPAIR_DISK_PATH)
|
||||||
|
.await
|
||||||
|
.with_ctx(|_| (ErrorKind::Filesystem, REPAIR_DISK_PATH))?;
|
||||||
|
}
|
||||||
|
if requires_reboot.0 {
|
||||||
|
crate::disk::main::export(&*guid, &ctx.datadir).await?;
|
||||||
|
return Err(Error::new(
|
||||||
|
eyre!(
|
||||||
|
"Errors were corrected with your disk, but the Embassy must be restarted in order to proceed"
|
||||||
|
),
|
||||||
|
ErrorKind::DiskManagement,
|
||||||
|
));
|
||||||
|
}
|
||||||
let product_key = ctx.product_key().await?;
|
let product_key = ctx.product_key().await?;
|
||||||
let product_key_path = Path::new("/embassy-data/main/product_key.txt");
|
let product_key_path = Path::new("/embassy-data/main/product_key.txt");
|
||||||
if tokio::fs::metadata(product_key_path).await.is_ok() {
|
if tokio::fs::metadata(product_key_path).await.is_ok() {
|
||||||
|
|||||||
Reference in New Issue
Block a user