-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathsetup.sh
More file actions
53 lines (37 loc) · 1.37 KB
/
setup.sh
File metadata and controls
53 lines (37 loc) · 1.37 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
#!/bin/bash
set -e
echo "=== Setting up Ally ==="
# script directory
INSTALL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# =========================== Step 1: Install requirements =================================
printf '\nInstalling dependencies...\n'
command -v uv >/dev/null 2>&1 || {
echo "Error: uv not found. Please install it from https://github.com/astral-sh/uv"
exit 1
}
cd "$INSTALL_DIR"
if [ ! -f "pyproject.toml" ]; then
uv init -p 3.13 2>&1
uv venv 2>&1
fi
uv pip install --no-cache --index-strategy unsafe-best-match -r requirements.txt
# =========================== Step 2: Create bin/ally launcher =============================
printf '\nCreating launcher script...\n'
# wrapper script
cat > ally <<EOF
#!/bin/bash
source "$INSTALL_DIR/.venv/bin/activate"
python3 "$INSTALL_DIR/main.py" "\$@"
EOF
chmod +x ally
# =========================== Step 3: Add bin to PATH ======================================
printf '\nInstalling ally to /usr/local/bin...\n'
# check if we have permission to write to /usr/local/bin, use sudo if needed
TARGET_PATH="/usr/local/bin/ally"
if [ -w "/usr/local/bin" ]; then
ln -sf "$INSTALL_DIR/ally" "$TARGET_PATH"
else
echo "Sudo permissions required to install to /usr/local/bin"
sudo ln -sf "$INSTALL_DIR/ally" "$TARGET_PATH"
fi
echo "=== Setup complete! You can now run 'ally' in a new terminal window ==="