Compare commits

..

No commits in common. "2f040c143842617c29507952a67b0ceda901ce81" and "93d3f67180eea97e320a26e307ef4c15dcb57071" have entirely different histories.

9 changed files with 54 additions and 172 deletions

BIN
.DS_Store vendored

Binary file not shown.

View file

@ -1,39 +0,0 @@
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
# Each operational script exposed as a runnable Bazel target
# (e.g. `bazel run //riotsecure:setup`).
sh_binary(
name = "setup",
srcs = ["setup.sh"],
)
sh_binary(
name = "setup_ollama",
srcs = ["setup_ollama.sh"],
)
sh_binary(
name = "setup_onyx",
srcs = ["setup_onyx.sh"],
)
sh_binary(
name = "check_status",
srcs = ["check-status.sh"],
)
sh_binary(
name = "cleanup",
srcs = ["cleanup.sh"],
)
sh_binary(
name = "fetch_content",
srcs = ["fetchContent.sh"],
)
sh_binary(
name = "update_models",
srcs = ["updateModels.sh"],
)

View file

@ -50,7 +50,6 @@ source "$REPO/steps/step_onyx.sh"
source "$REPO/steps/step_models.sh"
source "$REPO/steps/step_webconfig.sh"
source "$REPO/steps/step_rag.sh"
source "$REPO/steps/step_sleep.sh"
# ---------------------------------------------------------------------------
# Main setup
@ -74,7 +73,6 @@ install_homebrew
install_ollama
install_docker
install_onyx
prevent_sleep
setup_models
web_config "host.docker.internal"
rag_upload

View file

@ -45,7 +45,6 @@ source "$REPO/steps/preflight.sh"
source "$REPO/steps/step_homebrew.sh"
source "$REPO/steps/step_ollama.sh"
source "$REPO/steps/step_models.sh"
source "$REPO/steps/step_sleep.sh"
# ---------------------------------------------------------------------------
# Main setup
@ -67,7 +66,6 @@ preflight_checks --skip-docker
install_homebrew
install_ollama
setup_models
prevent_sleep
# =============================================================================
# Done

View file

@ -64,7 +64,6 @@ source "$REPO/steps/step_docker.sh"
source "$REPO/steps/step_onyx.sh"
source "$REPO/steps/step_webconfig.sh"
source "$REPO/steps/step_rag.sh"
source "$REPO/steps/step_sleep.sh"
# ---------------------------------------------------------------------------
# Detect where Ollama is running
@ -78,62 +77,36 @@ detect_ollama_host() {
local LOCAL_IP
LOCAL_IP=$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || echo "")
if [ -z "$LOCAL_IP" ]; then
print_warning "Could not determine local IP address." >&2
else
local SUBNET
SUBNET=$(echo "$LOCAL_IP" | cut -d. -f1-3)
echo "" >&2
print_warning "Scanning ${SUBNET}.0/24 for Ollama (port 11434)..." >&2
local TMPFILE
TMPFILE=$(mktemp)
# Launch all 254 checks simultaneously
for i in $(seq 1 254); do
local ip="${SUBNET}.${i}"
echo -e " ${BLUE}${NC} Checking $ip..." >&2
( nc -z -w 1 "$ip" 11434 2>/dev/null && echo "$ip" >> "$TMPFILE" ) &
done
# Poll every 200ms and stop as soon as the first result appears
while [ "$(jobs -rp | wc -l)" -gt 0 ]; do
if [ -s "$TMPFILE" ]; then
kill $(jobs -rp) 2>/dev/null || true
break
fi
sleep 0.2
done
wait 2>/dev/null
local FOUND=()
while IFS= read -r ip; do
FOUND+=("$ip")
done < "$TMPFILE"
rm -f "$TMPFILE"
if [ ${#FOUND[@]} -eq 1 ]; then
echo "${FOUND[0]}"
return
elif [ ${#FOUND[@]} -gt 1 ]; then
echo "" >&2
print_warning "Multiple hosts with Ollama found:" >&2
for i in "${!FOUND[@]}"; do
echo " $((i+1))) ${FOUND[$i]}" >&2
done
echo "" >&2
read -p "Select the Ollama host (1-${#FOUND[@]}): " pick <&2
echo "${FOUND[$((pick-1))]}"
return
fi
print_warning "Ollama not found on any device in ${SUBNET}.0/24." >&2
echo ""
return
fi
# Nothing found — ask the user directly
echo "" >&2
read -p "Enter the IP address of the Ollama device: " manual_ip <&2
echo "$manual_ip"
local SUBNET
SUBNET=$(echo "$LOCAL_IP" | cut -d. -f1-3)
print_warning "Ollama not found locally — scanning ${SUBNET}.0/24 for Ollama..."
local FOUND=()
for i in $(seq 1 254); do
if nc -z -w 1 "${SUBNET}.${i}" 11434 2>/dev/null; then
FOUND+=("${SUBNET}.${i}")
fi
done
if [ ${#FOUND[@]} -eq 1 ]; then
echo "${FOUND[0]}"
elif [ ${#FOUND[@]} -gt 1 ]; then
echo "" >&2
print_warning "Multiple hosts with Ollama found:" >&2
for i in "${!FOUND[@]}"; do
echo " $((i+1))) ${FOUND[$i]}" >&2
done
echo "" >&2
read -p "Select the Ollama host (1-${#FOUND[@]}): " pick >&2
echo "${FOUND[$((pick-1))]}"
else
echo ""
fi
}
# ---------------------------------------------------------------------------
@ -155,7 +128,6 @@ preflight_checks
install_homebrew
install_docker
install_onyx
prevent_sleep
# Resolve Ollama host after Docker is running so host.docker.internal works
if [ -n "$OLLAMA_HOST_OVERRIDE" ]; then
@ -165,6 +137,11 @@ else
print_warning "Detecting Ollama host..."
OLLAMA_HOST=$(detect_ollama_host)
if [ -z "$OLLAMA_HOST" ]; then
print_warning "Could not detect Ollama automatically."
read -p "Enter the IP address or hostname of the Ollama device: " OLLAMA_HOST
fi
if [ "$OLLAMA_HOST" = "host.docker.internal" ]; then
print_success "Ollama detected on this machine (single-device mode)"
else

View file

@ -16,19 +16,13 @@ install_docker() {
softwareupdate --install-rosetta --agree-to-license
print_success "Rosetta 2 ready"
print_warning "Waiting for Docker.app to appear in /Applications..."
local WAIT=0
while [ ! -d "/Applications/Docker.app" ]; do
if [ $WAIT -ge 30 ]; then
print_error "Docker.app not found in /Applications after 30s. Please install Docker Desktop manually."
exit 1
fi
sleep 2
WAIT=$((WAIT + 2))
done
print_warning "Opening Docker Desktop..."
open -a Docker
if [ -d "/Applications/Docker.app" ]; then
open -a Docker
else
print_error "Docker.app not found in /Applications. Please install Docker Desktop manually."
exit 1
fi
echo ""
echo "MANUAL STEP REQUIRED:"

View file

@ -1,9 +1,6 @@
#!/bin/bash
# Step: Install and start Ollama. Source common.sh before sourcing this file.
# Launchd plist that starts Ollama on all interfaces at login.
OLLAMA_PLIST="$HOME/Library/LaunchAgents/com.ollama.serve.plist"
install_ollama() {
print_step "Installing Ollama"
@ -16,55 +13,18 @@ install_ollama() {
print_success "Ollama installed successfully"
fi
# Register Ollama as a launchd agent so it:
# - starts automatically at login
# - listens on all interfaces (0.0.0.0) so other devices can reach it
print_warning "Configuring Ollama to listen on all network interfaces..."
mkdir -p "$HOME/Library/LaunchAgents"
cat > "$OLLAMA_PLIST" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.ollama.serve</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/ollama</string>
<string>serve</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>OLLAMA_HOST</key>
<string>0.0.0.0:11434</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/tmp/ollama.log</string>
<key>StandardErrorPath</key>
<string>/tmp/ollama.log</string>
</dict>
</plist>
EOF
print_warning "Starting Ollama service..."
if ! pgrep -x "ollama" > /dev/null; then
nohup ollama serve > /tmp/ollama.log 2>&1 &
sleep 3
# Stop any existing instance first so the new config takes effect
if pgrep -x "ollama" > /dev/null; then
print_warning "Restarting Ollama with network binding..."
launchctl unload "$OLLAMA_PLIST" 2>/dev/null || true
pkill -x ollama 2>/dev/null || true
sleep 1
fi
launchctl load "$OLLAMA_PLIST"
sleep 3
if pgrep -x "ollama" > /dev/null; then
print_success "Ollama service started (listening on 0.0.0.0:11434)"
if pgrep -x "ollama" > /dev/null; then
print_success "Ollama service started"
else
print_warning "Ollama service may not have started properly"
echo " Check logs at: /tmp/ollama.log"
fi
else
print_warning "Ollama service may not have started properly"
echo " Check logs at: /tmp/ollama.log"
print_success "Ollama service already running"
fi
}

View file

@ -20,4 +20,8 @@ install_onyx() {
print_success "Onyx installation complete"
fi
print_warning "Configuring power settings to prevent sleep..."
sudo pmset -a sleep 0 disksleep 0
print_success "Sleep prevention configured"
}

View file

@ -1,10 +0,0 @@
#!/bin/bash
# Step: Prevent the machine from sleeping. Source common.sh before sourcing this file.
prevent_sleep() {
print_step "Preventing Sleep"
print_warning "Configuring power settings to prevent sleep..."
sudo pmset -a sleep 0 disksleep 0
print_success "Sleep prevention configured"
}