feat: install Ollama prerequisites during plugin install

This commit is contained in:
Hermes Agent
2026-08-24 19:53:18 +10:00
parent a06c6f3628
commit f9526a58dc
3 changed files with 55 additions and 2 deletions
+2 -2
View File
@@ -55,7 +55,7 @@ This plugin is installable from the Hermes dashboard Plugin Section using the re
https://gitea.beyondcloud.solutions/dennii/Hermes-Ollama_Models.git https://gitea.beyondcloud.solutions/dennii/Hermes-Ollama_Models.git
``` ```
In Hermes Dashboard, open **Plugins**, choose **Install from repository**, enter the URL above, and install. The repository contains the root `plugin.yaml`, dashboard manifest, backend API, compiled frontend bundle, stylesheet, and dependency declaration required by the plugin installer. After installation or an update, restart only the Hermes dashboard service if requested by the installer. In Hermes Dashboard, open **Plugins**, choose **Install from repository**, enter the URL above, and install. The repository contains the root `plugin.yaml`, dashboard manifest, backend API, compiled frontend bundle, stylesheet, and an opt-in prerequisite declaration. On Linux, the Hermes installer will verify Ollama, install it with the official Ollama installer when missing, and install the plugin's `pypdf` dependency before committing the plugin into `~/.hermes/plugins/`. Ollama installation needs root or passwordless `sudo`; if the host cannot provide that, the plugin install stops without enabling a partially configured plugin. After installation or an update, restart only the Hermes dashboard service if requested by the installer.
## Security limits ## Security limits
@@ -67,7 +67,7 @@ In Hermes Dashboard, open **Plugins**, choose **Install from repository**, enter
## Dependency ## Dependency
Install the plugin's Python dependency in the Hermes runtime environment: The Hermes Plugin Section installs the declared `pypdf` dependency automatically before the plugin is committed. For a manual checkout, install it with:
```bash ```bash
pip install -r requirements.txt pip install -r requirements.txt
+5
View File
@@ -1,5 +1,10 @@
name: ollama-manager name: ollama-manager
version: 1.5.0 version: 1.5.0
description: Native dashboard manager and chat interface for local Ollama models, attachments, URLs, shared persistent conversations, performance metrics, and live runtime telemetry. description: Native dashboard manager and chat interface for local Ollama models, attachments, URLs, shared persistent conversations, performance metrics, and live runtime telemetry.
auto_install_dependencies: true
python_dependencies: python_dependencies:
- "pypdf>=6.0,<7.0" - "pypdf>=6.0,<7.0"
external_dependencies:
- name: Ollama
check: ollama --version
install: bash scripts/install_ollama.sh
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Install Ollama and its Linux prerequisites for Hermes-Ollama_Models.
set -Eeuo pipefail
if [[ "$(uname -s)" != "Linux" ]]; then
printf '%s\n' 'Automatic Ollama installation is currently supported on Linux only.' >&2
exit 1
fi
if command -v ollama >/dev/null 2>&1; then
ollama --version >/dev/null
exit 0
fi
run_privileged() {
if [[ "${EUID}" -eq 0 ]]; then
"$@"
elif command -v sudo >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then
sudo -n "$@"
else
printf '%s\n' 'Ollama installation needs root or passwordless sudo.' >&2
exit 1
fi
}
if ! command -v curl >/dev/null 2>&1; then
if command -v apt-get >/dev/null 2>&1; then
run_privileged apt-get update
run_privileged apt-get install -y curl ca-certificates
elif command -v dnf >/dev/null 2>&1; then
run_privileged dnf install -y curl ca-certificates
elif command -v yum >/dev/null 2>&1; then
run_privileged yum install -y curl ca-certificates
elif command -v pacman >/dev/null 2>&1; then
run_privileged pacman -Sy --noconfirm curl ca-certificates
else
printf '%s\n' 'Could not find a supported package manager to install curl and ca-certificates.' >&2
exit 1
fi
fi
installer="$(mktemp)"
trap 'rm -f "$installer"' EXIT
curl --fail --silent --show-error --location https://ollama.com/install.sh --output "$installer"
run_privileged sh "$installer"
command -v ollama >/dev/null 2>&1
ollama --version >/dev/null