From 9175faf0b4d8f57e474ebcbac58bde3e76c561fb Mon Sep 17 00:00:00 2001 From: Shaun Arman Date: Sun, 5 Apr 2026 20:29:28 -0500 Subject: [PATCH] =?UTF-8?q?refactor(ollama):=20remove=20download/install?= =?UTF-8?q?=20buttons=20=E2=80=94=20show=20plain=20install=20instructions?= =?UTF-8?q?=20only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/wiki/IPC-Commands.md | 10 ----- src-tauri/src/commands/system.rs | 71 -------------------------------- src-tauri/src/lib.rs | 1 - src-tauri/tauri.conf.json | 2 +- src/lib/tauriCommands.ts | 3 -- src/pages/Settings/Ollama.tsx | 36 +--------------- 6 files changed, 3 insertions(+), 120 deletions(-) diff --git a/docs/wiki/IPC-Commands.md b/docs/wiki/IPC-Commands.md index 2c1c8b84..d0b66498 100644 --- a/docs/wiki/IPC-Commands.md +++ b/docs/wiki/IPC-Commands.md @@ -218,16 +218,6 @@ getAuditLogCmd(filter: AuditLogFilter) → AuditEntry[] ``` Returns audit log entries. Filter by action, entity_type, date range. -### `install_ollama_from_bundle` -```typescript -installOllamaFromBundleCmd() → string -``` -Copies the Ollama binary bundled inside the app resources to the system install path: -- **Linux/macOS**: `/usr/local/bin/ollama` (requires write permission — user may need to run app with elevated privileges or `sudo`) -- **Windows**: `%LOCALAPPDATA%\Programs\Ollama\ollama.exe` - -Returns a success message with the install path. Errors if the bundled binary is not present in the app resources (i.e., the app was built without an Ollama bundle step in CI). - --- ## Integration Commands diff --git a/src-tauri/src/commands/system.rs b/src-tauri/src/commands/system.rs index 404955e3..a74846df 100644 --- a/src-tauri/src/commands/system.rs +++ b/src-tauri/src/commands/system.rs @@ -141,74 +141,3 @@ pub async fn get_audit_log( Ok(rows) } - -// Security note: the bundled binary's integrity is guaranteed by the CI release pipeline -// which verifies SHA256 checksums against Ollama's published sha256sums.txt before bundling. -// Runtime re-verification is not performed here; the app bundle itself is the trust boundary. -// On Unix, writing to /usr/local/bin requires elevated privileges. If the operation fails with -// PermissionDenied the caller receives an actionable error message. -#[tauri::command] -pub async fn install_ollama_from_bundle(app: tauri::AppHandle) -> Result { - use std::fs; - use std::path::PathBuf; - use tauri::Manager; - - let resource_dir = app - .path() - .resource_dir() - .map_err(|e: tauri::Error| e.to_string())?; - - let resource_path = resource_dir.join("ollama").join(if cfg!(windows) { - "ollama.exe" - } else { - "ollama" - }); - - if !resource_path.exists() { - return Err("Bundled Ollama not found in resources".to_string()); - } - - // Defense-in-depth: verify resolved path stays within the resource directory. - let canonical_resource = resource_path.canonicalize().map_err(|e| e.to_string())?; - let canonical_dir = resource_dir.canonicalize().map_err(|e| e.to_string())?; - if !canonical_resource.starts_with(&canonical_dir) { - return Err("Resource path validation failed".to_string()); - } - - #[cfg(unix)] - let install_path = PathBuf::from("/usr/local/bin/ollama"); - #[cfg(windows)] - let install_path = { - let local_app_data = std::env::var("LOCALAPPDATA").map_err(|e| e.to_string())?; - PathBuf::from(local_app_data) - .join("Programs") - .join("Ollama") - .join("ollama.exe") - }; - - if let Some(parent) = install_path.parent() { - fs::create_dir_all(parent).map_err(|e| e.to_string())?; - } - - fs::copy(&resource_path, &install_path).map_err(|e| { - if e.kind() == std::io::ErrorKind::PermissionDenied { - format!( - "Permission denied writing to {}. On Linux, re-run the app with elevated \ - privileges or install manually: sudo cp \"{}\" /usr/local/bin/ollama", - install_path.display(), - resource_path.display() - ) - } else { - e.to_string() - } - })?; - - #[cfg(unix)] - { - use std::os::unix::fs::PermissionsExt; - fs::set_permissions(&install_path, fs::Permissions::from_mode(0o755)) - .map_err(|e| e.to_string())?; - } - - Ok(format!("Ollama installed to {}", install_path.display())) -} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 64c91d81..6b147e2a 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -109,7 +109,6 @@ pub fn run() { commands::system::get_settings, commands::system::update_settings, commands::system::get_audit_log, - commands::system::install_ollama_from_bundle, ]) .run(tauri::generate_context!()) .expect("Error running Troubleshooting and RCA Assistant application"); diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a5b80085..d38ffc27 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -34,7 +34,7 @@ "icons/icon.icns", "icons/icon.ico" ], - "resources": ["resources/ollama/*"], + "resources": [], "externalBin": [], "copyright": "Troubleshooting and RCA Assistant Contributors", "category": "Utility", diff --git a/src/lib/tauriCommands.ts b/src/lib/tauriCommands.ts index bf1250f8..b1711134 100644 --- a/src/lib/tauriCommands.ts +++ b/src/lib/tauriCommands.ts @@ -436,6 +436,3 @@ export const getIntegrationConfigCmd = (service: string) => export const getAllIntegrationConfigsCmd = () => invoke("get_all_integration_configs"); - -export const installOllamaFromBundleCmd = () => - invoke("install_ollama_from_bundle"); diff --git a/src/pages/Settings/Ollama.tsx b/src/pages/Settings/Ollama.tsx index cd557ad2..419047c6 100644 --- a/src/pages/Settings/Ollama.tsx +++ b/src/pages/Settings/Ollama.tsx @@ -24,7 +24,6 @@ import { deleteOllamaModelCmd, listOllamaModelsCmd, getOllamaInstallGuideCmd, - installOllamaFromBundleCmd, type OllamaStatus, type HardwareInfo, type ModelRecommendation, @@ -44,7 +43,6 @@ export default function Ollama() { const [customModel, setCustomModel] = useState(""); const [isPulling, setIsPulling] = useState(false); const [pullProgress, setPullProgress] = useState(0); - const [isInstallingBundle, setIsInstallingBundle] = useState(false); const [error, setError] = useState(null); const loadData = async () => { @@ -107,19 +105,6 @@ export default function Ollama() { } }; - const handleInstallFromBundle = async () => { - setIsInstallingBundle(true); - setError(null); - try { - await installOllamaFromBundleCmd(); - await loadData(); - } catch (err) { - setError(String(err)); - } finally { - setIsInstallingBundle(false); - } - }; - const handleDelete = async (modelName: string) => { try { await deleteOllamaModelCmd(modelName); @@ -184,33 +169,16 @@ export default function Ollama() { {status && !status.installed && installGuide && ( - - + Ollama Not Detected — Installation Required - +
    {installGuide.steps.map((step, i) => (
  1. {step}
  2. ))}
-
- - -
)}