2020-08-11 03:04:29 -04:00
|
|
|
#!/bin/bash -e
|
|
|
|
|
2020-08-14 03:40:24 -04:00
|
|
|
install -m 644 files/octoprint.service ${ROOTFS_DIR}/etc/systemd/system/octoprint.service
|
2020-08-11 19:26:21 -04:00
|
|
|
|
2020-08-14 20:20:36 -04:00
|
|
|
install -m 644 files/nginx.conf ${ROOTFS_DIR}/etc/nginx/nginx.conf
|
2020-08-15 22:01:01 -04:00
|
|
|
echo -e "listen 443;" > ${ROOTFS_DIR}/etc/nginx/listen.conf
|
2020-08-14 20:20:36 -04:00
|
|
|
|
2020-08-11 05:18:14 -04:00
|
|
|
on_chroot << EOF
|
2020-08-17 02:49:15 -04:00
|
|
|
# Package enables this when installed, won't start until first-time is run due to missing SSL certs
|
|
|
|
systemctl disable nginx
|
2020-08-15 00:29:17 -04:00
|
|
|
# If OctoPrint already exists, skip this (for debugging)
|
2020-08-16 18:15:54 -04:00
|
|
|
if [[ ! -f /srv/octoprint/bin/octoprint ]]; then
|
|
|
|
cd /srv/ || exit 1
|
|
|
|
virtualenv octoprint || exit 1
|
|
|
|
source octoprint/bin/activate || exit 1
|
2020-08-13 05:42:11 -04:00
|
|
|
pip install pip --upgrade
|
|
|
|
pip install octoprint || exit 1
|
2020-08-15 00:29:17 -04:00
|
|
|
# Fix permissions
|
2020-08-13 05:42:11 -04:00
|
|
|
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
|