fix: chown /usr/share/ollama after install so ollama user can write to it

- The Ollama installer run via sudo leaves /usr/share/ollama owned by root
- The ollama service runs as the ollama user and needs write access
- Added chown after installation to fix permissions
This commit is contained in:
Claus Lohmar 2026-05-30 16:45:00 +00:00
parent 51c5d9a23e
commit 59f73830fb

View file

@ -195,6 +195,11 @@ case "$AI_CHOICE" in
info "Installing Ollama..." info "Installing Ollama..."
if ! command -v ollama &>/dev/null; then if ! command -v ollama &>/dev/null; then
sudo_if sh -c "$(curl -fsSL https://ollama.com/install.sh)" 2>&1 | tail -5 sudo_if sh -c "$(curl -fsSL https://ollama.com/install.sh)" 2>&1 | tail -5
# Fix permissions: the installer may leave /usr/share/ollama owned by root
# when run via sudo, but the ollama service runs as the ollama user
if id -u ollama &>/dev/null; then
sudo_if chown -R ollama:ollama /usr/share/ollama 2>/dev/null || true
fi
else else
info "Ollama already installed" info "Ollama already installed"
fi fi