Files
local-deep-research/scripts/ollama_entrypoint.sh
LearningCircuit 309b2a619e Fix shellcheck warnings in all shell scripts
- Quote variables to prevent word splitting (SC2086)
- Use 'read -r' to prevent backslash mangling (SC2162)
- Use 'cd ... || exit' for safe directory changes (SC2164)
- Use '-n' instead of '\! -z' for string checks (SC2236)
- Use pgrep instead of ps | grep (SC2009)
- Check exit codes directly instead of using $? (SC2181)
- Declare and assign separately for exports (SC2155)
- Fix unused loop variables with underscore prefix (SC2034)
- Remove stray markdown backticks from ollama_entrypoint.sh
2025-11-27 19:18:10 +01:00

40 lines
750 B
Bash
Executable File

#!/bin/bash
set -e
# Function to display usage information
usage() {
echo "Usage: $0 <model_name>"
exit 1
}
# Check if a model name is provided as an argument
if [ "$#" -ne 1 ]; then
usage
fi
MODEL_NAME=$1
# Start the main Ollama application
ollama serve &
# Wait for the Ollama application to be ready (optional, if necessary)
while ! ollama ls; do
echo "Waiting for Ollama service to be ready..."
sleep 10
done
echo "Ollama service is ready."
# Pull the model using ollama pull
echo "Pulling the $MODEL_NAME with ollama pull..."
# Check if the model was pulled successfully
if ollama pull "$MODEL_NAME"; then
echo "Model pulled successfully."
else
echo "Failed to pull model."
exit 1
fi
# Run ollama forever.
sleep infinity