Added OctoPrint service, made NoDM actually work

Changed the NoDM config so that it evaluated variables

Added OctoPrint service file

Started work on custom config tools

Browser now checks to see if OctoPrint is running before launching
browser
This commit is contained in:
Logan G 2020-08-11 17:26:21 -06:00
parent 99c4fbb46d
commit 76200d1b89
8 changed files with 42 additions and 10 deletions

View file

@ -4,6 +4,7 @@ install -d "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d"
install -m 644 files/noclear.conf "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d/noclear.conf" install -m 644 files/noclear.conf "${ROOTFS_DIR}/etc/systemd/system/getty@tty1.service.d/noclear.conf"
install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab" install -v -m 644 files/fstab "${ROOTFS_DIR}/etc/fstab"
install -m 755 files/.xprofile "${ROOTFS_DIR}/etc/skel/.xprofile" install -m 755 files/.xprofile "${ROOTFS_DIR}/etc/skel/.xprofile"
install -m 755 files/.browser.sh "${ROOTFS_DIR}/etc/skel/.browser.sh"
mkdir -p "${ROOTFS_DIR}/etc/skel/.config/openbox" mkdir -p "${ROOTFS_DIR}/etc/skel/.config/openbox"
install -m 644 files/autostart "${ROOTFS_DIR}/etc/skel/.config/openbox/autostart" install -m 644 files/autostart "${ROOTFS_DIR}/etc/skel/.config/openbox/autostart"

View file

@ -0,0 +1,8 @@
#!/bin/bash
# Wait until OctoPrint comes up
while ! curl localhost:5000 2>&1 >/dev/null; do
sleep 1
done
surf -d -F -g -K -n -p localhost:5000

View file

@ -1 +1 @@
surf -d -F -g -K -n -p google.com & bash ~/.browser.sh &

View file

@ -0,0 +1,4 @@
#!/bin/bash -e
mkdir -p "${ROOTFS_DIR}/usr/local/bin/"
install -m 755 files/octo-config "${ROOTFS_DIR}/usr/local/bin/octo-config"

View file

@ -0,0 +1,3 @@
#!/bin/bash

View file

@ -1,13 +1,17 @@
#!/bin/bash -e #!/bin/bash -e
install -m 644 files/octoprint.service ${ROOTFS_DIR}/etc/systemd/system/octoprint.service
on_chroot << EOF on_chroot << EOF
if [ -d /home/octoprint ]; then if ! pip list | grep -F octoprint; then
cd /home/octoprint || exit 1 if [ -d /home/octoprint ]; then
mkdir OctoPrint || exit 1 cd /home/octoprint || exit 1
cd OctoPrint || exit 1 if [[ ! -d OctoPrint ]]; then mkdir OctoPrint; fi || exit 1
virtualenv venv || exit 1 cd OctoPrint || exit 1
source venv/bin/activate || exit 1 virtualenv venv || exit 1
pip install pip --upgrade || exit 1 source venv/bin/activate || exit 1
pip install octoprint || exit 1 pip install pip --upgrade || exit 1
pip install octoprint || exit 1
fi
fi fi
EOF EOF

View file

@ -0,0 +1,12 @@
[Unit]
Description=OctoPrint Daemon
[Service]
Type=simple
User=octoprint
Group=octoprint
ExecStart=/home/octoprint/OctoPrint/venv/bin/octoprint serve
[Install]
WantedBy=multi-user.target

View file

@ -2,7 +2,7 @@
#echo -n -e "NODM_USER=${FIRST_USER_NAME}\nNODM_XSESSION=/home/${FIRST_USER_NAME}/.xprofile" > ${ROOTFS_DIR}/etc/nodm.conf #echo -n -e "NODM_USER=${FIRST_USER_NAME}\nNODM_XSESSION=/home/${FIRST_USER_NAME}/.xprofile" > ${ROOTFS_DIR}/etc/nodm.conf
cat > /etc/default/nodm << 'EOF' cat > ${ROOTFS_DIR}/etc/default/nodm << EOF
# nodm configuration # nodm configuration
# Set NODM_ENABLED to something different than 'false' to enable nodm # Set NODM_ENABLED to something different than 'false' to enable nodm