Initial commit: EliteDesk + Pi display daemons
- EliteDesk: 240x320 color ST7789 via Pico (Day 32 design)
- Pi: 128x64 mono SSD1306 horizontal bars (Day 85 redesign)
🦊 Built with love by Vixy
This commit is contained in:
57
pi/daemon/install.sh
Normal file
57
pi/daemon/install.sh
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# Install Pi Stats Display as systemd service
|
||||
# Run as root on each Pi node
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SERVICE_NAME="pi-display"
|
||||
INSTALL_DIR="/opt/pi-display"
|
||||
|
||||
echo "Installing Pi Stats Display..."
|
||||
|
||||
# Create install directory
|
||||
mkdir -p "$INSTALL_DIR"
|
||||
|
||||
# Copy daemon script
|
||||
cp "$SCRIPT_DIR/pi_stats_display.py" "$INSTALL_DIR/"
|
||||
chmod +x "$INSTALL_DIR/pi_stats_display.py"
|
||||
|
||||
# Install Python dependencies
|
||||
apt install -y python3-pip python3-pil python3-psutil i2c-tools
|
||||
pip3 install luma.oled --break-system-packages 2>/dev/null || pip3 install luma.oled
|
||||
|
||||
# Enable I2C if not already
|
||||
if ! grep -q "^dtparam=i2c_arm=on" /boot/config.txt 2>/dev/null && \
|
||||
! grep -q "^dtparam=i2c_arm=on" /boot/firmware/config.txt 2>/dev/null; then
|
||||
echo "dtparam=i2c_arm=on" >> /boot/firmware/config.txt 2>/dev/null || \
|
||||
echo "dtparam=i2c_arm=on" >> /boot/config.txt
|
||||
echo "I2C enabled - reboot required!"
|
||||
fi
|
||||
|
||||
# Create systemd service
|
||||
cat > /etc/systemd/system/${SERVICE_NAME}.service << EOF
|
||||
[Unit]
|
||||
Description=Pi Node Status Display
|
||||
After=network.target k3s-agent.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/python3 ${INSTALL_DIR}/pi_stats_display.py
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
User=root
|
||||
Environment=DISPLAY=
|
||||
Environment=REFRESH_MS=500
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
# Reload and enable
|
||||
systemctl daemon-reload
|
||||
systemctl enable ${SERVICE_NAME}
|
||||
systemctl start ${SERVICE_NAME}
|
||||
|
||||
echo "Done! Service status:"
|
||||
systemctl status ${SERVICE_NAME} --no-pager
|
||||
Reference in New Issue
Block a user