Skip to content

Commit a63fb79

Browse files
committed
fix(ai): skip systemd related stuff in docker
1 parent 7dfb149 commit a63fb79

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

install.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,22 @@ curl -fsSL https://ollama.com/download/ollama-linux-amd64.tar.zst \
166166
| sudo tar x --zstd -C /usr
167167
sudo useradd -r -s /bin/false -U -m -d /usr/share/ollama ollama
168168
sudo usermod -a -G ollama "$(whoami)"
169-
sudo cp ~/.dotfiles/ollama/ollama.service /etc/systemd/system/
170-
sudo systemctl daemon-reload
171-
sudo systemctl enable --now ollama.service
172-
# HACK: wait for ollama server to start
173-
# on docker build, ollama server needs to be started manually
174-
nohup /usr/sbin/ollama serve > /dev/null 2>&1 & sleep 5
169+
170+
if systemctl is-system-running; then
171+
echo "systemd running"
172+
sudo cp ~/.dotfiles/ollama/ollama.service /etc/systemd/system/
173+
sudo systemctl daemon-reload
174+
sudo systemctl enable --now ollama.service
175+
176+
else
177+
echo "systemd not running"
178+
# HACK: wait for ollama server to start
179+
# on docker build, ollama server needs to be started manually
180+
export PATH="$PATH:/usr/sbin/ollama"
181+
nohup ollama serve > /dev/null 2>&1 & sleep 5
182+
183+
fi
184+
175185
ollama create -f ~/.dotfiles/ollama/modelfile_gpt-oss-20b-ol gpt-oss-20b-ol
176186
ollama rm gpt-oss:20b
177187

0 commit comments

Comments
 (0)