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

22 lines
718 B
Bash
Raw Normal View History

#!/bin/bash -e
install -m 644 files/octoprint.service ${ROOTFS_DIR}/etc/systemd/system/octoprint.service
2020-08-11 20:25:59 -04:00
install -m 644 files/first-time.service ${ROOTFS_DIR}/etc/systemd/system/first-time.service
install -m 755 files/first-time.sh ${ROOTFS_DIR}/usr/local/bin/first-time.sh
2020-08-11 05:18:14 -04:00
on_chroot << EOF
2020-08-11 20:25:59 -04:00
systemctl set-default multi-user.target
systemctl enable first-time
if ! pip list | grep -F octoprint; then
if [ -d /home/octoprint ]; then
cd /home/octoprint || exit 1
if [[ ! -d OctoPrint ]]; then mkdir OctoPrint; fi || exit 1
cd OctoPrint || exit 1
virtualenv venv || exit 1
source venv/bin/activate || exit 1
pip install pip --upgrade || exit 1
pip install octoprint || exit 1
fi
2020-08-11 05:18:14 -04:00
fi
EOF