diff --git a/README.md b/README.md index 4a743d7..a3cdbe9 100644 --- a/README.md +++ b/README.md @@ -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 ``` -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 @@ -67,7 +67,7 @@ In Hermes Dashboard, open **Plugins**, choose **Install from repository**, enter ## 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 pip install -r requirements.txt diff --git a/plugin.yaml b/plugin.yaml index 29e0633..12025a8 100644 --- a/plugin.yaml +++ b/plugin.yaml @@ -1,5 +1,10 @@ name: ollama-manager 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. +auto_install_dependencies: true python_dependencies: - "pypdf>=6.0,<7.0" +external_dependencies: + - name: Ollama + check: ollama --version + install: bash scripts/install_ollama.sh diff --git a/scripts/install_ollama.sh b/scripts/install_ollama.sh new file mode 100755 index 0000000..abd2644 --- /dev/null +++ b/scripts/install_ollama.sh @@ -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