-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
179 lines (160 loc) · 6.18 KB
/
Copy pathinstall.sh
File metadata and controls
179 lines (160 loc) · 6.18 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
#!/usr/bin/env bash
# FPPT One-Click Install for macOS / Linux
# Requires: Python 3.10+
set -e
echo "========================================"
echo " FPPT Installer (macOS / Linux)"
echo "========================================"
echo
# Step 1: Check Python version (multi-command detection)
echo "[1/5] Checking Python..."
PYTHON_CMD=""
# Try python3.12 first
if command -v python3.12 &> /dev/null; then
PYTHON_CMD="python3.12"
elif command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif command -v python &> /dev/null; then
PYTHON_CMD="python"
fi
# --- Python not found. Try brew on macOS. ---
if [ -z "$PYTHON_CMD" ]; then
echo " Python not found on this system."
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS: try brew auto-install
if command -v brew &> /dev/null; then
echo
echo " ======================================================"
echo " Found Homebrew package manager."
echo " I can install Python 3.12 automatically for you."
echo
echo " Install Python 3.12 now? [Y/n]"
echo " ======================================================"
read -r CONFIRM
if [ "$CONFIRM" = "n" ] || [ "$CONFIRM" = "N" ]; then
echo " Cancelled."
exit 1
fi
echo
echo " Installing Python 3.12 via Homebrew..."
echo " (This may take a few minutes)"
brew install python@3.12
if [ $? -ne 0 ]; then
echo " WARNING: brew returned an error. Trying to continue anyway..."
fi
# Re-detect Python
if command -v python3.12 &> /dev/null; then
PYTHON_CMD="python3.12"
elif command -v python3 &> /dev/null; then
PYTHON_CMD="python3"
elif [ -f "$(brew --prefix python@3.12 2>/dev/null)/bin/python3" ]; then
PYTHON_CMD="$(brew --prefix python@3.12)/bin/python3"
fi
if [ -n "$PYTHON_CMD" ]; then
echo " Python installed successfully."
else
echo " Install completed but Python cannot be found on PATH."
echo " Please restart your terminal and run install.sh again."
exit 1
fi
else
# macOS: no python, no brew — print fallback
echo
echo " Python 3.10+ is required but not found."
echo " Install Homebrew first:"
echo " /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\""
echo " Then install Python: brew install python@3.12"
echo
echo " Or download Python manually: https://www.python.org/downloads/"
exit 1
fi
else
# Linux: detect package manager and print instructions (don't auto-install)
FOUND_PM=""
if command -v apt &> /dev/null; then
FOUND_PM="apt"
echo
echo " Python 3.10+ is required but not found."
echo " Run the following to install:"
echo " sudo apt update && sudo apt install -y python3 python3-venv python3-pip"
elif command -v dnf &> /dev/null; then
FOUND_PM="dnf"
echo
echo " Python 3.10+ is required but not found."
echo " Run the following to install:"
echo " sudo dnf install -y python3 python3-pip"
elif command -v yum &> /dev/null; then
FOUND_PM="yum"
echo
echo " Python 3.10+ is required but not found."
echo " Run the following to install:"
echo " sudo yum install -y python3 python3-pip"
elif command -v pacman &> /dev/null; then
FOUND_PM="pacman"
echo
echo " Python 3.10+ is required but not found."
echo " Run the following to install:"
echo " sudo pacman -S python python-pip"
elif command -v zypper &> /dev/null; then
FOUND_PM="zypper"
echo
echo " Python 3.10+ is required but not found."
echo " Run the following to install:"
echo " sudo zypper install -y python3 python3-pip"
elif command -v apk &> /dev/null; then
FOUND_PM="apk"
echo
echo " Python 3.10+ is required but not found."
echo " Run the following to install:"
echo " sudo apk add python3 py3-pip"
fi
if [ -z "$FOUND_PM" ]; then
echo
echo " Python 3.10+ is required but not found."
echo " Could not detect your package manager."
echo " Please install Python 3.10+ manually: https://www.python.org/downloads/"
fi
exit 1
fi
fi
# Display version
PYVER=$($PYTHON_CMD --version 2>&1 | awk '{print $2}')
echo " Found Python $PYVER"
# Version >= 3.10 check
$PYTHON_CMD -c "import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)" || {
echo "ERROR: Python 3.10+ required. Found $PYVER"
echo "Please install Python 3.10 or newer from https://python.org"
exit 1
}
# Step 2: Create virtual environment
echo "[2/5] Creating virtual environment..."
$PYTHON_CMD -m venv venv
if [ $? -ne 0 ]; then
echo "ERROR: Failed to create venv"
exit 1
fi
# Step 3: Install Python dependencies
echo "[3/5] Installing Python dependencies..."
venv/bin/pip install -r requirements.txt
if [ $? -ne 0 ]; then
echo "ERROR: Failed to install dependencies"
exit 1
fi
# Step 4: Install Playwright browsers
echo "[4/5] Installing Playwright Chromium..."
venv/bin/playwright install chromium || {
echo "WARNING: Playwright browser install failed. Some features may be unavailable."
}
# Step 5: Verify
echo "[5/5] Verifying installation..."
venv/bin/python -c "import flask, pptx, yaml, requests; print('OK')" || {
echo "ERROR: Verification failed"
exit 1
}
echo
echo "========================================"
echo " Installation complete!"
echo
echo " Desktop: venv/bin/python desktop/main.py"
echo " AI Use: Import SKILL.md into your AI agent terminal"
echo "========================================"