Fix
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# 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
|
||||
|
||||
# Show help
|
||||
./ollama-update --help
|
||||
```
|
||||
|
||||
## 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
|
||||
@@ -157,6 +157,12 @@ install_ollama() {
|
||||
# Skript ausführbar machen und ausführen.
|
||||
chmod +x "$tmp_script" || die "Konnte Installations-Skript nicht ausführbar machen."
|
||||
"$tmp_script" || die "Installation von Ollama ist fehlgeschlagen."
|
||||
|
||||
# Erfolg: temporäre Datei löschen und Trap entfernen, damit er beim
|
||||
# späteren Script-Exit nicht auf eine nicht mehr existierende lokale
|
||||
# Variable zugreift (sonst Fehler wegen 'set -u').
|
||||
trap - EXIT
|
||||
rm -f "$tmp_script"
|
||||
}
|
||||
|
||||
main() {
|
||||
|
||||
Reference in New Issue
Block a user