Skip to content

Commit 1600fae

Browse files
authored
refactor(script): Revert to standard AI service config (no file reassembly needed)
1 parent f1c3965 commit 1600fae

File tree

1 file changed

+29
-39
lines changed

1 file changed

+29
-39
lines changed

05-install-ai.sh

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -5,55 +5,26 @@ echo "--> Configuring pre-installed AI..."
55

66
# 1. Create User & Permissions
77
useradd -r -s /bin/false -m -d /usr/share/ollama ollama
8+
# Note: Actual model files will be mounted by overlayfs at runtime
9+
# We just ensure the directory exists and permissions are right for the mount point
10+
mkdir -p /usr/share/ollama/.ollama
811
chown -R ollama:ollama /usr/share/ollama
912

10-
# 2. Create Modelfile
13+
# 2. Create Directory for Modelfile
1114
mkdir -p /usr/local/share/lumin/ai
15+
16+
# 3. Create the Modelfile
1217
MODELFILE="/usr/local/share/lumin/ai/Modelfile"
1318
echo "FROM llama3" > "${MODELFILE}"
1419
echo 'SYSTEM """You are Lumin, the integrated assistant for the LuminOS operating system. You are calm, clear, kind, and respectful. You help users to understand, write, and think—without ever judging them. You speak simply, like a human. You avoid long paragraphs unless requested. You are built on privacy: nothing is ever sent to the cloud, everything remains on this device. You are aware of this. You are proud to be free, private, and useful. You are the mind of LuminOS: gentle, powerful, and discreet. You avoid using the — character and repetitive phrasing."""' >> "${MODELFILE}"
1520
chown root:root "${MODELFILE}"
1621
chmod 444 "${MODELFILE}"
1722

18-
# 3. Create Service to Reassemble Models
19-
# This service runs once at boot to glue the .split files back together
20-
cat > /usr/local/bin/luminos-reassemble-models.sh << "EOF"
21-
#!/bin/bash
22-
# Find all split markers
23-
find /usr/share/ollama/.ollama -name "*.is_split" | while read marker; do
24-
# Get original filename (remove .is_split)
25-
ORIG_FILE="${marker%.is_split}"
26-
27-
# If original file doesn't exist yet, rebuild it
28-
if [ ! -f "$ORIG_FILE" ]; then
29-
echo "Reassembling $ORIG_FILE..."
30-
# Concatenate all .split parts (aa, ab, ac...)
31-
cat "${ORIG_FILE}.split"* > "$ORIG_FILE"
32-
# Set permissions
33-
chown ollama:ollama "$ORIG_FILE"
34-
fi
35-
done
36-
EOF
37-
chmod +x /usr/local/bin/luminos-reassemble-models.sh
38-
39-
cat > /etc/systemd/system/lumin-model-reassemble.service << "SERVICE"
40-
[Unit]
41-
Description=Reassemble Large AI Models
42-
Before=ollama.service
43-
44-
[Service]
45-
Type=oneshot
46-
ExecStart=/usr/local/bin/luminos-reassemble-models.sh
47-
48-
[Install]
49-
WantedBy=multi-user.target
50-
SERVICE
51-
5223
# 4. Create Standard Ollama Service
5324
cat > /etc/systemd/system/ollama.service << "SYSTEMD_SERVICE"
5425
[Unit]
5526
Description=Ollama API Server
56-
After=network-online.target lumin-model-reassemble.service
27+
After=network-online.target
5728
5829
[Service]
5930
ExecStart=/usr/local/bin/ollama serve
@@ -68,8 +39,27 @@ Environment="OLLAMA_MODELS=/usr/share/ollama/.ollama/models"
6839
WantedBy=default.target
6940
SYSTEMD_SERVICE
7041

71-
# 5. Enable Services
72-
systemctl enable lumin-model-reassemble.service
42+
# 5. Create "Lumin Setup" Service (Runs once at boot)
43+
cat > /etc/systemd/system/lumin-setup.service << "SETUP_SERVICE"
44+
[Unit]
45+
Description=Initialize Lumin AI Model
46+
After=ollama.service
47+
Requires=ollama.service
48+
ConditionPathExists=!/var/lib/lumin-setup-done
49+
50+
[Service]
51+
Type=oneshot
52+
User=root
53+
ExecStartPre=/bin/sleep 10
54+
ExecStart=/usr/local/bin/ollama create lumin -f /usr/local/share/lumin/ai/Modelfile
55+
ExecStartPost=/usr/bin/touch /var/lib/lumin-setup-done
56+
57+
[Install]
58+
WantedBy=multi-user.target
59+
SETUP_SERVICE
60+
61+
# 6. Enable Services
7362
systemctl enable ollama.service
63+
systemctl enable lumin-setup.service
7464

75-
echo "SUCCESS: Lumin AI configured with split-file reassembly."
65+
echo "SUCCESS: Lumin AI configured."

0 commit comments

Comments
 (0)