-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·213 lines (177 loc) · 6.87 KB
/
install.sh
File metadata and controls
executable file
·213 lines (177 loc) · 6.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/bin/bash
# TalkiTo Quick Installer
# This script provides a one-liner installation method for talkito
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Detect OS
OS="$(uname -s)"
ARCH="$(uname -m)"
echo "🎙️ Installing TalkiTo..."
echo ""
# Function to check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Install system dependencies based on OS
install_system_deps() {
case "$OS" in
Darwin*)
echo "📦 Installing macOS dependencies..."
if ! command_exists brew; then
echo -e "${RED}❌ Homebrew not found. Please install from https://brew.sh${NC}"
exit 1
fi
# Install portaudio if not present
if ! brew list portaudio &>/dev/null; then
echo " Installing portaudio..."
brew install portaudio
else
echo " ✓ portaudio already installed"
fi
;;
Linux*)
echo "📦 Installing Linux dependencies..."
if command_exists apt-get; then
echo " Detected Debian/Ubuntu system"
sudo apt-get update -qq
sudo apt-get install -y python3-pip python3-venv portaudio19-dev git
elif command_exists yum; then
echo " Detected Red Hat/Fedora system"
sudo yum install -y python3-pip python3-venv portaudio-devel git
elif command_exists pacman; then
echo " Detected Arch Linux system"
sudo pacman -Sy --noconfirm python-pip python-virtualenv portaudio git
elif command_exists apk; then
echo " Detected Alpine Linux system"
sudo apk add --no-cache python3 py3-pip portaudio-dev git
else
echo -e "${YELLOW}⚠️ Could not detect package manager. Please install these manually:${NC}"
echo " - Python 3.10+"
echo " - pip3"
echo " - portaudio development files"
echo " - git"
exit 1
fi
;;
*)
echo -e "${RED}❌ Unsupported OS: $OS${NC}"
echo " talkito currently supports macOS and Linux"
exit 1
;;
esac
}
# Create virtual environment and install talkito
install_talkito() {
echo ""
echo "🚀 Installing talkito..."
# Create a temporary directory for installation
TEMP_DIR=$(mktemp -d)
cd "$TEMP_DIR"
# Clone the repository
echo " Cloning repository..."
git clone --quiet https://github.com/robdmac/talkito.git
cd talkito
# Create virtual environment
echo " Creating virtual environment..."
python3 -m venv venv
# Activate virtual environment
source venv/bin/activate
# Upgrade pip with trusted hosts (avoids SSL bug in Python 3.10)
echo " Upgrading pip..."
pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org
# Install talkito (all features included by default)
echo " Installing talkito..."
pip install --quiet --trusted-host pypi.org --trusted-host files.pythonhosted.org -e .
# Create a wrapper script
echo " Creating launcher script..."
INSTALL_DIR="$HOME/.local/bin"
mkdir -p "$INSTALL_DIR"
cat > "$INSTALL_DIR/talkito" << EOF
#!/bin/bash
# TalkiTo launcher script
"$TEMP_DIR/talkito/venv/bin/python" "$TEMP_DIR/talkito/talkito.py" "\$@"
EOF
chmod +x "$INSTALL_DIR/talkito"
# Store installation path for potential uninstall
mkdir -p "$HOME/.config/talkito"
echo "$TEMP_DIR/talkito" > "$HOME/.config/talkito/install_path"
echo -e "${GREEN} ✓ Installation complete${NC}"
}
# Check system requirements
check_requirements() {
echo "🔍 Checking system requirements..."
# Check Python version
if ! command_exists python3; then
echo -e "${RED}❌ Python 3 is required but not found${NC}"
echo " Please install Python 3.10 or higher"
exit 1
fi
PYTHON_VERSION=$(python3 -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
REQUIRED_VERSION="3.10"
if ! python3 -c "import sys; exit(0 if sys.version_info >= (3, 10) else 1)"; then
echo -e "${RED}❌ Python $REQUIRED_VERSION or higher is required (found $PYTHON_VERSION)${NC}"
exit 1
fi
echo " ✓ Python $PYTHON_VERSION"
# Check git
if ! command_exists git; then
echo -e "${YELLOW}⚠️ git not found, will install${NC}"
else
echo " ✓ git installed"
fi
}
# Main installation flow
main() {
# Print banner
echo -e "${BLUE}╔═══════════════════════════════════╗${NC}"
echo -e "${BLUE}║ TalkiTo Quick Installer ║${NC}"
echo -e "${BLUE}╚═══════════════════════════════════╝${NC}"
echo ""
# Check requirements
check_requirements
# Install dependencies
echo ""
install_system_deps
# Install talkito
install_talkito
# Update PATH if needed
export PATH="$HOME/.local/bin:$PATH"
# Success message
echo ""
echo -e "${GREEN}╔═══════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ ✅ TalkiTo installed successfully! ║${NC}"
echo -e "${GREEN}╚═══════════════════════════════════════════╝${NC}"
echo ""
echo "🎯 Quick start:"
echo -e " ${BLUE}talkito claude${NC}"
echo ""
echo "📖 For more options:"
echo -e " ${BLUE}talkito --help${NC}"
echo ""
# Check if PATH needs to be updated
if ! echo $PATH | grep -q "$HOME/.local/bin"; then
echo -e "${YELLOW}⚠️ Important: Add ~/.local/bin to your PATH${NC}"
echo ""
echo "Add this line to your shell configuration file:"
echo ""
if [[ "$SHELL" == *"zsh"* ]]; then
echo -e " ${BLUE}echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.zshrc${NC}"
echo -e " ${BLUE}source ~/.zshrc${NC}"
else
echo -e " ${BLUE}echo 'export PATH=\"\$HOME/.local/bin:\$PATH\"' >> ~/.bashrc${NC}"
echo -e " ${BLUE}source ~/.bashrc${NC}"
fi
echo ""
echo "Or run talkito directly with:"
echo -e " ${BLUE}~/.local/bin/talkito claude${NC}"
fi
}
# Handle errors
trap 'echo -e "\n${RED}❌ Installation failed. Please check the error messages above.${NC}"' ERR
# Run main function
main "$@"