1+ #! /bin/bash
2+
3+ # Voice2Text AI Linux Installer
4+ # This script installs Ollama, pulls the required model, installs the flatpak, and tests Ollama.
5+
6+ set -e
7+
8+ echo " Voice2Text AI Linux Installer"
9+ echo " ============================="
10+
11+ # Install flatpak if not installed
12+ if ! command -v flatpak & > /dev/null; then
13+ echo " Installing flatpak..."
14+ sudo apt-get update
15+ sudo apt-get install -y flatpak
16+ flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
17+ fi
18+
19+ # Download and install latest Ollama
20+ echo " Downloading latest Ollama..."
21+ OLLAMA_URL=$( curl -s https://api.github.com/repos/ollama/ollama/releases/latest | grep " browser_download_url.*linux-amd64" | cut -d ' "' -f 4)
22+ if [ -z " $OLLAMA_URL " ]; then
23+ echo " Failed to find Ollama download URL"
24+ exit 1
25+ fi
26+ wget -O ollama-linux-amd64.tgz " $OLLAMA_URL "
27+ tar -xzf ollama-linux-amd64.tgz
28+ sudo mv ollama /usr/local/bin/
29+ rm ollama-linux-amd64.tgz
30+
31+ # Start Ollama service (assuming systemd)
32+ echo " Starting Ollama service..."
33+ sudo useradd -r -s /bin/false ollama || true
34+ sudo mkdir -p /etc/systemd/system
35+ cat << EOF | sudo tee /etc/systemd/system/ollama.service
36+ [Unit]
37+ Description=Ollama Service
38+ After=network-online.target
39+
40+ [Service]
41+ ExecStart=/usr/local/bin/ollama serve
42+ User=ollama
43+ Group=ollama
44+ Restart=always
45+ RestartSec=3
46+
47+ [Install]
48+ WantedBy=default.target
49+ EOF
50+ sudo systemctl daemon-reload
51+ sudo systemctl enable ollama
52+ sudo systemctl start ollama
53+
54+ # Wait for Ollama to start
55+ echo " Waiting for Ollama to start..."
56+ sleep 10
57+
58+ # Pull the model
59+ echo " Pulling qwen2.5:0.5b model..."
60+ ollama pull qwen2.5:0.5b
61+
62+ # Install the flatpak
63+ echo " Installing Voice2Text AI flatpak..."
64+ flatpak install -y --user com.voice2text.app.flatpak
65+
66+ # Test Ollama
67+ echo " Testing Ollama..."
68+ if ollama list | grep -q " qwen2.5:0.5b" ; then
69+ echo " Ollama test passed: Model qwen2.5:0.5b is installed."
70+ else
71+ echo " Ollama test failed: Model not found."
72+ exit 1
73+ fi
74+
75+ echo " Installation complete! Run 'flatpak run com.voice2text.app' to start the app."
0 commit comments