-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·43 lines (34 loc) · 1.23 KB
/
install.sh
File metadata and controls
executable file
·43 lines (34 loc) · 1.23 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
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Environment name
ENV_NAME="shellyenv"
# Check if virtual environment exists, create if it doesn't
if [ ! -d "$SCRIPT_DIR/$ENV_NAME" ]; then
echo "Creating virtual environment..."
python3 -m venv "$SCRIPT_DIR/$ENV_NAME"
fi
# Activate virtual environment
source "$SCRIPT_DIR/$ENV_NAME/bin/activate"
# Install requirements if requirements.txt exists
if [ -f "$SCRIPT_DIR/requirements.txt" ]; then
echo "Installing requirements..."
pip install -r "$SCRIPT_DIR/requirements.txt"
else
echo "No requirements.txt found, skipping package installation"
fi
# Create symbolic link for the launch script
if [ ! -f "/usr/local/bin/shelly" ]; then
echo "Creating shelly command..."
sudo ln -s "$SCRIPT_DIR/launch.sh" /usr/local/bin/shelly
sudo chmod +x /usr/local/bin/shelly
fi
echo "Installation complete!"
echo "You can now use the 'shelly' command from anywhere"
```
And keep your `launch.sh` simple:
```bash
#!/bin/bash
# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Activate the virtual environment and run the app
source "$SCRIPT_DIR/shellyenv/bin/activate"
python3 "$SCRIPT_DIR/my_app.py" "$@"