touchprint/stage2/04-octoprint/01-run.sh

24 lines
809 B
Bash
Raw Normal View History

#!/bin/bash -e
install -m 644 files/octoprint.service ${ROOTFS_DIR}/etc/systemd/system/octoprint.service
install -m 644 files/nginx.conf ${ROOTFS_DIR}/etc/nginx/nginx.conf
echo -e "listen 80;" > ${ROOTFS_DIR}/etc/nginx/listen.conf
2020-08-11 05:18:14 -04:00
on_chroot << EOF
2020-08-15 00:29:17 -04:00
# If OctoPrint already exists, skip this (for debugging)
if [[ ! -f /srv/octoprint/venv/bin/octoprint ]]; then
if [[ ! -d /srv/octoprint ]]; then mkdir -p /srv/octoprint; fi
cd /srv/octoprint || exit 1
2020-08-15 00:29:17 -04:00
# https://community.octoprint.org/t/setting-up-octoprint-on-a-raspberry-pi-running-raspbian/2337/
virtualenv venv || exit 1
source venv/bin/activate || exit 1
pip install pip --upgrade
pip install octoprint || exit 1
2020-08-15 00:29:17 -04:00
# Fix permissions
chown -R octoprint:octoprint /srv/octoprint
2020-08-11 05:18:14 -04:00
fi
2020-08-15 00:29:17 -04:00
# Enable the reverse proxy
systemctl enable nginx
2020-08-11 05:18:14 -04:00
EOF