#!/bin/bash # Check for certificates and start haproxy set -x BaseDir=/opt/octoprint/data/octoprint #if [ ! -f ${BaseDir}/config.yaml ]; then # if [[ "${WITH_KLIPPER}" == "yes" ]]; then # echo "*** Copying initial config file and enabling klipper" # mkdir -p ${BaseDir} ## yq -Y --arg octo_printer "${OCTO_PRINTER}" --arg printer_cfg "${PRINTER_CFG}" --arg klipper_log "${OCTO_PRINTER}/klippy.log" --arg klipper_port "${OCTO_PRINTER}/printer" ' .serial.abortHeatupOnCancel = false | .serial.disconnectOnErrors = false | .serial.additionalPorts = [$octo_printer] | .serial.baudrate = 250000 | .serial.port = $octo_printer | .serial.timeout.communication = 40 | .serial.timeout.temperature = 9.0 | .serial.timeout.temperatureAutoreport = 3.0 | .serial.timeout.temperatureTargetSet = 6.0 | .serial.unknownCommandsNeedAck = true | .plugins.klipper._config_version = 2 ' etc/config.yaml > ${BaseDir}/config.yaml # fi #fi #| .plugins.klipper.configuration.configpath = $octo_printer/$printer_cfg \ #| .plugins.klipper.configuration.logpath = $klipper_log \ #| .plugins.klipper.connection.port = $klipper_port \ #| .plugins.tracking.enabled = false \ #| .server.firstRun = false \ #| .server.commands.serverRestartCommand = "/opt/octoprint/bin/restart.sh" \ #| .server.commands.systemRestartCommand = "/opt/octoprint/bin/reboot.sh" \ #| .server.commands.systemShutdownCommand = "/opt/octoprint/bin/poweroff.sh" \ #| .server.onlineCheck.enabled = true \ #| .server.onlineCheck.host = "94.247.43.254" \ #| .server.pluginBlacklist.enabled = true \ #| .server.seenWizards.backup = null \ #| .server.seenWizards.corewizard = 3 \ #| .server.seenWizards.tracking = null ' \ #etc/config.yaml > ${BaseDir}/config.yaml echo "*** Set permissions on $(dirname ${OCTO_PRINTER})" chmod 775 ${OCTO_PRINTER} echo "*** Starting octoprint" exec /opt/octoprint/OctoPrint/venv/bin/octoprint --basedir ${BaseDir} serve --iknowwhatimdoing