adding ollama installer
This commit is contained in:
40
scripts/bootstrap_ollama_linux.sh
Executable file
40
scripts/bootstrap_ollama_linux.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
echo "🔧 Ollama Linux bootstrap — starting"
|
||||
|
||||
# Load environment (MODEL_ROOT, OLLAMA_MODELS)
|
||||
# Temporarily disable "nounset" when sourcing user shell files to avoid
|
||||
# failures from system /etc/bashrc referencing undefined vars like PS1.
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
set +u
|
||||
# shellcheck disable=SC1091
|
||||
source "$HOME/.bashrc" || true
|
||||
set -u
|
||||
fi
|
||||
|
||||
: "${OLLAMA_MODELS:=$HOME/models/ollama}"
|
||||
mkdir -p "$OLLAMA_MODELS"
|
||||
|
||||
if command -v ollama >/dev/null 2>&1; then
|
||||
echo "✅ ollama already installed: $(ollama version 2>/dev/null || echo 'unknown')"
|
||||
else
|
||||
echo "ℹ️ Attempting to install ollama on Linux"
|
||||
if command -v apt-get >/dev/null 2>&1; then
|
||||
echo "Using apt to install prerequisites..."
|
||||
sudo apt-get update -y || true
|
||||
sudo apt-get install -y ca-certificates curl gnupg lsb-release || true
|
||||
echo "⚠️ Please follow the official ollama Linux install instructions if a package is not available: https://ollama.com/docs/install"
|
||||
echo "If you have a .deb from Ollama, install it with: sudo dpkg -i <file.deb>"
|
||||
elif command -v dnf >/dev/null 2>&1; then
|
||||
echo "Using dnf; please refer to Ollama docs for distro-specific instructions: https://ollama.com/docs/install"
|
||||
else
|
||||
echo "⚠️ Could not detect package manager. Please install ollama manually. See: https://ollama.com/docs/install"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "📁 Ensuring model directory exists: $OLLAMA_MODELS"
|
||||
mkdir -p "$OLLAMA_MODELS"
|
||||
|
||||
echo "✅ Linux Ollama bootstrap complete."
|
||||
echo "Next steps: run scripts/ollama_tmux.sh to start the server in tmux, and place models under $OLLAMA_MODELS"
|
||||
Reference in New Issue
Block a user