66 lines
1.6 KiB
Markdown
66 lines
1.6 KiB
Markdown
# AGENTS.md — Ollama-Updater
|
|
|
|
Single-file Bash script (`ollama-update`) that updates Ollama to latest stable or beta.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
# Run script (stable channel)
|
|
./ollama-update
|
|
|
|
# Run script (beta channel)
|
|
./ollama-update --beta
|
|
./ollama-update -b
|
|
|
|
# Force installation of older version (downgrade)
|
|
./ollama-update --force
|
|
./ollama-update -f
|
|
|
|
# Combine with beta channel
|
|
./ollama-update --beta --force
|
|
./ollama-update -b -f
|
|
|
|
# Show help
|
|
./ollama-update --help
|
|
./ollama-update -h
|
|
```
|
|
|
|
## Lint / Check
|
|
|
|
```bash
|
|
# ShellCheck (recommended)
|
|
shellcheck ollama-update
|
|
|
|
# Run with bash strict mode (what the script uses)
|
|
bash -euo pipefail ollama-update --help
|
|
```
|
|
|
|
## Structure
|
|
|
|
- `ollama-update` — main script (executable, bash, ~240 lines)
|
|
- `README.md` — usage docs
|
|
|
|
## Key behaviors
|
|
|
|
- Uses GitHub API (`api.github.com/repos/ollama/ollama/releases`) to fetch versions
|
|
- Downloads and runs official `ollama.com/install.sh` via `OLLAMA_VERSION` env var for version pinning
|
|
- SemVer comparison with suffix support (`cmp_versions` function)
|
|
- Requires: `curl`, `grep`, `sed`, `sort`, `mktemp`, `chmod`
|
|
- Runs without root for version checks; install may need root (systemd service)
|
|
|
|
## Testing
|
|
|
|
No formal test suite. Manual verification:
|
|
|
|
```bash
|
|
# Dry-run version checks (no install)
|
|
./ollama-update # shows local/stable/beta versions
|
|
./ollama-update --beta # shows beta comparison
|
|
```
|
|
|
|
## Gotchas
|
|
|
|
- Script uses `set -euo pipefail` and `nullglob` — preserve these
|
|
- GitHub API rate limits: unauthenticated = 60 req/hr
|
|
- Beta channel compares against stable; only updates if beta > stable AND beta > local
|
|
- Temp install script cleaned via `trap` on EXIT |