-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·125 lines (106 loc) · 3.35 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·125 lines (106 loc) · 3.35 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
#!/bin/bash
# Exit on error
set -e
echo "Starting W-AV setup..."
# Update system
# echo "Updating system packages..."
# sudo apt-get update
# sudo apt-get upgrade -y
# Install system dependencies
echo "Installing system dependencies..."
sudo apt-get install -y \
python3-pip \
python3-venv \
nodejs \
npm \
x11-xserver-utils \
openbox \
firefox-esr \
alsa-utils \
python3-pyqt5 \
python3-numpy \
python3-scipy \
python3-pyqtgraph \
libportaudio2 \
portaudio19-dev \
python3-pyaudio \
git
# Install Node.js dependencies
echo "Installing Node.js dependencies..."
cd "$(dirname "$0")"
npm install
# Create and activate Python virtual environment
echo "Setting up Python virtual environment..."
python3 -m venv env
source env/bin/activate
# Install Python dependencies
echo "Installing Python dependencies..."
pip install --upgrade pip
pip install -r requirements.txt
# Additional Python packages needed for specific scripts
pip install \
pyaudio \
pyqtgraph \
adafruit-blinka \
adafruit-circuitpython-mcp3xxx \
RPi.GPIO \
requests
# Setup systemd services
echo "Setting up systemd services..."
sudo cp boot_files/power-switch.service /etc/systemd/system/
sudo cp boot_files/gpio-control.service /etc/systemd/system/
sudo cp boot_files/gpio-rotary-control.service /etc/systemd/system/
# Reload systemd and enable services
sudo systemctl daemon-reload
sudo systemctl enable power-switch.service
sudo systemctl enable gpio-control.service
sudo systemctl enable gpio-rotary-control.service
# Setup boot configuration
# echo "Setting up boot configuration..."
# if [ -f "/boot/config.txt" ]; then
# echo "Backing up existing config.txt..."
# sudo cp /boot/config.txt /boot/config.txt.backup
# echo "Copying W-AV config.txt..."
# sudo cp boot_files/config.txt /boot/config.txt
# else
# echo "Warning: /boot/config.txt not found. Make sure boot partition is mounted."
# fi
# if [ -f "/boot/cmdline.txt" ]; then
# echo "Backing up existing cmdline.txt..."
# sudo cp /boot/cmdline.txt /boot/cmdline.txt.backup
# echo "Copying W-AV cmdline.txt..."
# sudo cp boot_files/cmdline.txt /boot/cmdline.txt
# else
# echo "Warning: /boot/cmdline.txt not found. Make sure boot partition is mounted."
# fi
# Setup .bash_profile
echo "Setting up .bash_profile..."
cat > ~/.bash_profile << EOL
[[ -z \$DISPLAY && \$XDG_VTNR -eq 1 ]] && startx /home/wave/W-AV/minimal-x-session.sh
EOL
# Make scripts executable
echo "Making scripts executable..."
chmod +x minimal-wav-start.sh
chmod +x minimal-x-session.sh
# Create necessary directories
echo "Creating necessary directories..."
mkdir -p .credentials
# Create template .env file if it doesn't exist
echo "Setting up environment configuration..."
if [ ! -f .env ]; then
cat > .env << EOL
# Spotify API Credentials
# Get these values from https://developer.spotify.com/dashboard
SPOTIFY_CLIENT_ID=your_client_id_here
SPOTIFY_CLIENT_SECRET=your_client_secret_here
# Optional: Server Port (defaults to 8888 if not set)
PORT=8888
EOL
echo "Created template .env file. Please edit it with your Spotify API credentials."
fi
# Setup logging directories
echo "Setting up logging..."
sudo touch /var/log/w-av.log
sudo chown wave:wave /var/log/w-av.log
echo "Setup complete! Please reboot your system."
echo "After reboot, the W-AV system should start automatically."