octoprint-containers/klipper/bin/run.sh

22 lines
916 B
Bash
Executable File

#!/usr/bin/env bash
# We use the octoklipper_vol to share klippers pseudo-terminal with octoprint, additionally the octoprint plugin requires access to the printer.cfg and klipper.log
# Create a symlink in the octoklipper_vol to the printer.cfg to be shared with the octoklipper plugin in the octoprint container.
# ln -sf /home/klippy/.config/klipper/printer/${PRINTER_CFG} ${KLIPPER_HOME}/${PRINTER_CFG}
cp /home/klippy/.config/klipper/printer/${PRINTER_CFG} ${KLIPPER_HOME}/${PRINTER_CFG}
echo "*** Starting ser2net"
ser2net -d -u -C "${SER2NET_CONFIG}" &
# Substitute serial device in the printer config
sed -i 's,^\(serial: \).*,\1'${KLIPPER_SERIAL}',' ${KLIPPER_HOME}/${PRINTER_CFG}
touch ${KLIPPER_HOME}/klippy.log
echo "*** Starting klipper"
${PYTHONDIR}/bin/python3 ${SRCDIR}/klippy/klippy.py ${KLIPPER_HOME}/${PRINTER_CFG} --logfile ${KLIPPER_HOME}/klippy.log --input-tty ${OCTO_PRINTER}/printer