# Running out-of-date Raspberry Pi OS
apt-get update --allow-releaseinfo-change
# Reclaim some disk space
sudo apt-get clean
# Install prerequisite software
apt-get install -y libsnmp-dev snmp-mibs-downloader libcec-dev
# Create service definition
nano /lib/systemd/system/picontrol.service
[Unit]
Description=PiControl
After=network-online.target
Wants=network-online.target
[Service]
Type=idle
ExecStart=python3 -B /srv/picontrol/picontrol.py
Restart=always
RestartSec=1s
StartLimitInterval=0
[Install]
WantedBy=multi-user.target
# Install required Python modules
python3 -m pip install websocket-client cec flask-socketio netifaces pyserial easysnmp
# Copy Python files and dependencies
mkdir -p /srv/picontrol && cd /srv/picontrol
curl -L https://dev.lindisfarne.nsw.edu.au/picontrol/picontrol-0.0.30d.zip -o /tmp/picontrol.zip
unzip /tmp/picontrol.zip
rm /tmp/picontrol.zip
# Enable and start service
systemctl enable picontrol && systemctl start picontrol