mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
@@ -231,8 +231,9 @@ pub async fn import<P: AsRef<Path>>(guid: &str, datadir: P, password: &str) -> R
|
||||
{
|
||||
Ok(_) => Ok(()),
|
||||
Err(e)
|
||||
if format!("{}", e.source).trim()
|
||||
== format!("Volume group \"{}\" is not exported", guid) =>
|
||||
if format!("{}", e.source)
|
||||
.lines()
|
||||
.any(|l| l.trim() == format!("Volume group \"{}\" is not exported", guid)) =>
|
||||
{
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ pub async fn init(cfg: &RpcContextConfig) -> Result<(), Error> {
|
||||
tracing::info!("Mounted Docker Data");
|
||||
|
||||
crate::install::load_images(cfg.datadir().join(PKG_DOCKER_DIR)).await?;
|
||||
tracing::info!("Loaded Docker Images");
|
||||
tracing::info!("Loaded Package Docker Images");
|
||||
// Loading system images
|
||||
crate::install::load_images("/var/lib/embassy/system-images").await?;
|
||||
tracing::info!("Loaded System Docker Images");
|
||||
|
||||
@@ -52,7 +52,7 @@ where
|
||||
Ok(password)
|
||||
}
|
||||
|
||||
#[command(subcommands(status, disk, execute, recovery, cifs, complete))]
|
||||
#[command(subcommands(status, disk, attach, execute, recovery, cifs, complete))]
|
||||
pub fn setup() -> Result<(), Error> {
|
||||
Ok(())
|
||||
}
|
||||
@@ -84,6 +84,24 @@ pub async fn list_disks() -> Result<Vec<DiskInfo>, Error> {
|
||||
crate::disk::list(None).await
|
||||
}
|
||||
|
||||
#[command(rpc_only)]
|
||||
pub async fn attach(
|
||||
#[context] ctx: SetupContext,
|
||||
#[arg] guid: Arc<String>,
|
||||
) -> Result<SetupResult, Error> {
|
||||
crate::disk::main::import(&*guid, &ctx.datadir, DEFAULT_PASSWORD).await?;
|
||||
init(&RpcContextConfig::load(ctx.config_path.as_ref()).await?).await?;
|
||||
*ctx.disk_guid.write().await = Some(guid.clone());
|
||||
let secrets = ctx.secret_store().await?;
|
||||
let tor_key = crate::net::tor::os_key(&mut secrets.acquire().await?).await?;
|
||||
let (_, root_ca) = SslManager::init(secrets).await?.export_root_ca().await?;
|
||||
Ok(SetupResult {
|
||||
tor_address: format!("http://{}", tor_key.public().get_onion_address()),
|
||||
lan_address: format!("https://embassy-{}.local", crate::hostname::get_id().await?),
|
||||
root_ca: String::from_utf8(root_ca.to_pem()?)?,
|
||||
})
|
||||
}
|
||||
|
||||
#[command(subcommands(v2, recovery_status))]
|
||||
pub fn recovery() -> Result<(), Error> {
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user