feat: Implement initial backend structure with API, WebSocket, core models, services, and documentation, alongside dependency and gitignore updates.
This commit is contained in:
1 parent
f82191dd83
commit
7710be86a6
29 files changed
+3927
-1301
No files matched your search
@@ -0,0 +1,37 @@
|
||||
use super::InstallStrategy;
|
||||
use crate::ws::{WsEvent, WsEventKind};
|
||||
use std::collections::HashMap;
|
||||
use std::process::Command;
|
||||
use tokio::sync::broadcast;
|
||||
|
||||
pub struct LinuxInstallStrategy;
|
||||
|
||||
impl InstallStrategy for LinuxInstallStrategy {
|
||||
fn install(
|
||||
&self,
|
||||
details: &mut HashMap<String, String>,
|
||||
issues: &mut Vec<String>,
|
||||
broker: &broadcast::Sender<WsEvent>,
|
||||
) -> Result<(), String> {
|
||||
let _ = broker.send(WsEvent {
|
||||
kind: WsEventKind::Log,
|
||||
message: "Iniciando instalação no Linux...".into(),
|
||||
});
|
||||
|
||||
// Script oficial de instalação
|
||||
let install_cmd = "curl -fsSL https://ollama.com/install.sh | sh";
|
||||
|
||||
let status = Command::new("sh")
|
||||
.arg("-c")
|
||||
.arg(install_cmd)
|
||||
.status()
|
||||
.map_err(|e| format!("Falha ao executar script de instalação: {}", e))?;
|
||||
|
||||
if !status.success() {
|
||||
return Err("Script de instalação falhou".into());
|
||||
}
|
||||
|
||||
details.insert("method".to_string(), "curl_script".to_string());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user