Skip to content

Commit 7aaf61c

Browse files
authored
fix(script): Start ollama service before pulling model
1 parent 1c52370 commit 7aaf61c

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

05-install-ai.sh

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#!/bin/bash
2-
#!/bin/bash
32
# ==============================================================================
43
# LuminOS Build Script - Phase 5: Local AI Integration
54
# Author: Gabriel, Project Leader @ LuminOS
6-
# Version: 0.1.5 (Debug Verbose)
5+
# Version: 0.1.6
76
# ==============================================================================
8-
set -e # Keep this to stop on errors
7+
set -e
98
LUMINOS_CHROOT_DIR="chroot"
109
OLLAMA_VERSION="0.1.32"
1110
BASE_MODEL="llama3"
@@ -24,12 +23,7 @@ chmod +x ollama
2423
echo "--> Installing Ollama binary into the system..."
2524
mv ollama "$LUMINOS_CHROOT_DIR/usr/local/bin/"
2625

27-
# --- Start Verbose Debugging ---
28-
echo "--> Enabling verbose output..."
29-
set -x
30-
3126
# Create the script to be run inside the chroot
32-
echo "--> Attempting to create internal AI configuration script..."
3327
cat > "$LUMINOS_CHROOT_DIR/tmp/configure_ai.sh" << EOF
3428
#!/bin/bash
3529
set -e
@@ -51,6 +45,12 @@ WantedBy=default.target
5145
SYSTEMD_SERVICE
5246
echo "--> Enabling Ollama service to start on boot..."
5347
systemctl enable ollama.service
48+
49+
echo "--> Starting Ollama service now..." # Added step
50+
systemctl start ollama.service # Added command
51+
echo "--> Waiting for Ollama service to initialize..." # Added step
52+
sleep 5 # Added short delay
53+
5454
echo "--> Creating Lumin AI definition directory..."
5555
mkdir -p /usr/local/share/lumin/ai
5656
echo "--> Creating the read-only Modelfile for Lumin..."
@@ -63,26 +63,23 @@ chown root:root /usr/local/share/lumin/ai/Modelfile
6363
chmod 444 /usr/local/share/lumin/ai/Modelfile
6464
rm /tmp/configure_ai.sh
6565
EOF
66-
echo "--> Internal script created. Checking file..."
67-
ls -l "$LUMINOS_CHROOT_DIR/tmp/configure_ai.sh"
6866

69-
echo "--> Attempting to make internal script executable..."
7067
chmod +x "$LUMINOS_CHROOT_DIR/tmp/configure_ai.sh"
71-
echo "--> Internal script permissions set."
7268

73-
# --- Stop Verbose Debugging ---
74-
set +x
75-
echo "--> Disabling verbose output."
76-
77-
# --- Mounts, Chroot Execution, Unmounts remain the same ---
69+
# --- Mounts, Chroot Execution, Unmounts ---
7870
echo "--> Mounting virtual filesystems for chroot..."
7971
mount --bind /dev "$LUMINOS_CHROOT_DIR/dev"; mount --bind /dev/pts "$LUMINOS_CHROOT_DIR/dev/pts"; mount -t proc /proc "$LUMINOS_CHROOT_DIR/proc"; mount -t sysfs /sys "$LUMINOS_CHROOT_DIR/sys"
72+
8073
echo "--> Entering chroot to configure AI service..."
8174
chroot "$LUMINOS_CHROOT_DIR" env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /tmp/configure_ai.sh
75+
8276
echo "--> IMPORTANT: Pulling base model '${BASE_MODEL}' inside chroot. This will take some time..."
77+
# Note: Pulling happens *after* the service is started by configure_ai.sh
8378
chroot "$LUMINOS_CHROOT_DIR" env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/local/bin/ollama pull ${BASE_MODEL}
79+
8480
echo "--> Creating custom 'Lumin' model from Modelfile..."
8581
chroot "$LUMINOS_CHROOT_DIR" env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /usr/local/bin/ollama create lumin -f /usr/local/share/lumin/ai/Modelfile
82+
8683
echo "--> Unmounting virtual filesystems..."
8784
umount "$LUMINOS_CHROOT_DIR/sys"; umount "$LUMINOS_CHROOT_DIR/proc"; umount "$LUMINOS_CHROOT_DIR/dev/pts"; umount "$LUMINOS_CHROOT_DIR/dev"
8885

0 commit comments

Comments
 (0)