-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.sh.dev
More file actions
executable file
·58 lines (47 loc) · 1.66 KB
/
Copy pathinstall.sh.dev
File metadata and controls
executable file
·58 lines (47 loc) · 1.66 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
#!/bin/bash
# Exit on any error
set -e
echo "Installing VinylPi..."
# Check if running as root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root (use sudo)"
exit 1
fi
# Get the actual user who ran sudo
ACTUAL_USER=$SUDO_USER
if [ -z "$ACTUAL_USER" ]; then
echo "Could not determine the actual user"
exit 1
fi
# Get user's home directory
USER_HOME=$(getent passwd $ACTUAL_USER | cut -d: -f6)
# Install system dependencies
echo "Installing system dependencies..."
apt-get update
apt-get install -y python3-pip python3-pyaudio portaudio19-dev
# Install Python packages globally
echo "Installing Python packages..."
pip3 install --break-system-packages -r requirements.txt
# Create log files and set permissions
echo "Setting up log files..."
touch /var/log/vinylpi.log
touch /var/log/vinylpi.error.log
chown $ACTUAL_USER:$ACTUAL_USER /var/log/vinylpi.log
chown $ACTUAL_USER:$ACTUAL_USER /var/log/vinylpi.error.log
# Update service file with correct user and paths
echo "Configuring service..."
INSTALL_DIR="$PWD"
sed -i "s|ExecStart=.*|ExecStart=/usr/bin/python3 $INSTALL_DIR/vinylpi-web/backend/main.py|" vinylpi.service
sed -i "s|WorkingDirectory=.*|WorkingDirectory=$INSTALL_DIR|" vinylpi.service
sed -i "s|User=.*|User=$ACTUAL_USER|" vinylpi.service
# Install and enable service
echo "Installing systemd service..."
cp vinylpi.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable vinylpi
systemctl start vinylpi
echo "VinylPi installation complete!"
echo "The web interface should be available at http://localhost:8000"
echo "To view logs:"
echo " - Application log: tail -f /var/log/vinylpi.log"
echo " - Error log: tail -f /var/log/vinylpi.error.log"