diff options
author | Guy Sheffer <guysoft@gmail.com> | 2018-02-21 15:49:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-21 15:49:11 +0300 |
commit | 35fa0b3d54f3e5d5394f91e7a93e826fae7c30ff (patch) | |
tree | ab0955c8173b3fb56ca4f2c4b11c73f75b62a992 | |
parent | 825cb9eb4f992fec61630847b01527c0cdd7de01 (diff) | |
parent | 7c8ad04770a7356e4d1d8d474e38a1e9245f4295 (diff) |
Merge pull request #484 from foosel/improve/pip-install-octoprint
Install OctoPrint from network via pip
5 files changed, 62 insertions, 12 deletions
diff --git a/src/modules/octopi/config b/src/modules/octopi/config index 5a8a737..12544a6 100755 --- a/src/modules/octopi/config +++ b/src/modules/octopi/config @@ -1,12 +1,14 @@ ############################################################################### # All our config settings must start with OCTOPI_ -# OctoPrint repo & branch +# OctoPrint archive +[ -n "$OCTOPI_OCTOPRINT_ARCHIVE" ] || OCTOPI_OCTOPRINT_ARCHIVE=$(curl -s https://api.github.com/repos/foosel/OctoPrint/releases/latest | grep "zipball_url" | cut -d : -f 2,3 | tr -d \" | tr -d ,) [ -n "$OCTOPI_OCTOPRINT_REPO_SHIP" ] || OCTOPI_OCTOPRINT_REPO_SHIP=https://github.com/foosel/OctoPrint.git -[ -n "$OCTOPI_OCTOPRINT_REPO_BUILD" ] || OCTOPI_OCTOPRINT_REPO_BUILD= -[ -n "$OCTOPI_OCTOPRINT_REPO_BRANCH" ] || OCTOPI_OCTOPRINT_REPO_BRANCH=master [ -n "$OCTOPI_INCLUDE_OCTOPRINT" ] || OCTOPI_INCLUDE_OCTOPRINT=yes +# PyBonjour archive +[ -n "$OCTOPI_PYBONJOUR_ARCHIVE" ] || OCTOPI_PYBONJOUR_ARCHIVE=https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz + # CuraEngine archive & version [ -n "$OCTOPI_CURAENGINE_VERSION" ] || OCTOPI_CURAENGINE_VERSION=15.04.6 [ -n "$OCTOPI_CURAENGINE_ARCHIVE" ] || OCTOPI_CURAENGINE_ARCHIVE=https://github.com/Ultimaker/CuraEngine/archive/$OCTOPI_CURAENGINE_VERSION.zip @@ -25,3 +27,5 @@ # WiringPi [ -n "$OCTOPI_INCLUDE_WIRINGPI" ] || OCTOPI_INCLUDE_WIRINGPI=yes +# yq +[ -n "$OCTOPI_YQ_DOWNLOAD" ] || OCTOPI_YQ_DOWNLOAD=$(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | grep "browser_download_url" | grep "yq_linux_arm" | cut -d : -f 2,3 | tr -d \" | tr -d ,) diff --git a/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml b/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml index 1089900..88361e3 100644 --- a/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml +++ b/src/modules/octopi/filesystem/home/pi/.octoprint/config.yaml @@ -7,10 +7,6 @@ plugins: cura_engine: /usr/local/bin/cura_engine discovery: publicPort: 80 - softwareupdate: - checks: - octoprint: - update_folder: /home/pi/OctoPrint server: commands: systemShutdownCommand: sudo shutdown -h now diff --git a/src/modules/octopi/filesystem/home/pi/OctoPrint/README.txt b/src/modules/octopi/filesystem/home/pi/OctoPrint/README.txt new file mode 100644 index 0000000..4214bd8 --- /dev/null +++ b/src/modules/octopi/filesystem/home/pi/OctoPrint/README.txt @@ -0,0 +1,7 @@ +OctoPrint 1.3.6 and newer no longer rely on a git checkout for updates, +so OctoPi no longer goes that route either. + +Feel free to manually create a git clone though if you need it (e.g. for +branch based updates or on board development): + + ~/scripts/add-octoprint-checkout diff --git a/src/modules/octopi/filesystem/home/pi/scripts/add-octoprint-checkout b/src/modules/octopi/filesystem/home/pi/scripts/add-octoprint-checkout new file mode 100755 index 0000000..615a2d9 --- /dev/null +++ b/src/modules/octopi/filesystem/home/pi/scripts/add-octoprint-checkout @@ -0,0 +1,43 @@ +#!/bin/bash + +OCTOPRINT_FOLDER=/home/pi/OctoPrint +OCTOPRINT_CONFIG=/home/pi/.octoprint/config.yaml + +pause() { + read -n1 -r -p $'Press any key to continue or Ctrl+C to exit...\n' key +} + +echo +echo "This will add a git checkout of OctoPrint to ~/OctoPrint." +echo +echo "This can be helpful if you want to run development branches" +echo "of OctoPrint or do local development yourself." +echo +echo "It is however not needed for OctoPrint's normal operation." +echo +echo "If you do not want to add the git checkout after all, please" +echo "hit Ctrl+C now." +echo + +pause + +echo "--- Adding git checkout" + +rm -r $OCTOPRINT_FOLDER || true +git clone https://github.com/foosel/OctoPrint.git $OCTOPRINT_FOLDER + +echo "--- Configuring checkout folder in OctoPrint's config.yaml" + +echo "plugins: {softwareupdate: {checks: {octoprint: {update_folder: $OCTOPRINT_FOLDER}}}}" | yq m -i $OCTOPRINT_CONFIG - + +echo +echo "--- Done!" +echo + +echo "Your git checkout is now available at ~/OctoPrint. Please note that it" +echo "is currently not installed. If you want to replace the default installation" +echo "of OctoPrint with whatever is currently checked out in your git checkout" +echo "you'll need to do this manually. You'll also need to keep your checkout" +echo "up to date manually if you still have OctoPrint's update mode set to release" +echo "tracking." +echo diff --git a/src/modules/octopi/start_chroot_script b/src/modules/octopi/start_chroot_script index b8382ec..a5f37f9 100755 --- a/src/modules/octopi/start_chroot_script +++ b/src/modules/octopi/start_chroot_script @@ -44,13 +44,10 @@ pushd /home/pi echo "--- Installing OctoPrint" #pybonjour (for mdns discovery) - sudo -u pi /home/pi/oprint/bin/pip install https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pybonjour/pybonjour-1.1.1.tar.gz + sudo -u pi /home/pi/oprint/bin/pip install $OCTOPI_PYBONJOUR_ARCHIVE #OctoPrint - gitclone OCTOPI_OCTOPRINT_REPO OctoPrint - pushd OctoPrint - PIP_DEFAULT_TIMEOUT=60 sudo -u pi /home/pi/oprint/bin/python setup.py install - popd + PIP_DEFAULT_TIMEOUT=60 sudo -u pi /home/pi/oprint/bin/pip install $OCTOPI_OCTOPRINT_ARCHIVE fi #mjpg-streamer @@ -117,6 +114,9 @@ EOT echo "--- Installing WiringPi" apt-get install wiringpi fi + + # fetch current yq build and install to /usr/local/bin + wget -O yq $OCTOPI_YQ_DOWNLOAD && chmod +x yq && mv yq /usr/local/bin popd |