-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup
executable file
·51 lines (38 loc) · 1.36 KB
/
setup
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
#!/bin/bash
# Check if arguments were passed
if [ $# -gt 0 ]; then
# Set the first argument as the path to the Python executable
python_path=$1
else
# Set the path to the Python executable to "python3"
python_path="python3"
fi
# Check if the Python version is 3.10 or higher
if [ "$($python_path -c 'import sys; print(sys.version_info[0])')" -lt 3 ] || [ "$($python_path -c 'import sys; print(sys.version_info[1])')" -lt 10 ]; then
echo "Python 3.10 or higher is required to run this program."
# Print the current Python version
echo "Current Python version: $($python_path -c 'import sys; print(sys.version_info[0])').$($python_path -c 'import sys; print(sys.version_info[1])')"
exit 1
fi
# Check if a virtual environment exists
if [ ! -d venv ]; then
# Create a virtual environment
$python_path -m venv venv
fi
# Activate the environment
source venv/bin/activate
# Install the requirements
pip install -r requirements.txt
# Run the initial setup
python bridge.py --initial_setup
# Make sure "bridge" is executable
chmod +x bridge
# Add "bridge" to the user's PATH based on their favorite shell
# If .bashrc exists, add the line to it
if [ -f ~/.bashrc ]; then
echo "export \"PATH=\$PATH:$(pwd)\"" >> ~/.bashrc
fi
# If .zshrc exists, add the line to it
if [ -f ~/.zshrc ]; then
echo "export \"PATH=\$PATH:$(pwd)\"" >> ~/.zshrc
fi