From 801fa12a8914a09ee56f3c3ad4dc6a8f2f0ef493 Mon Sep 17 00:00:00 2001 From: TimonGaebelein Date: Sat, 12 Oct 2019 17:01:38 +0200 Subject: [PATCH] Make scripts more versatile --- scripts/install-no-autostart.sh | 21 +++++++++++++++------ scripts/install.sh | 23 +++++++++++++++-------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/scripts/install-no-autostart.sh b/scripts/install-no-autostart.sh index 445f68d82..1a6e9198b 100755 --- a/scripts/install-no-autostart.sh +++ b/scripts/install-no-autostart.sh @@ -4,12 +4,21 @@ release=$(curl -s "https://api.github.com/repos/UnchartedBull/OctoDash/releases/ dependencies="libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libappindicator3-1 libsecret-1-0 gir1.2-gnomekeyring-1.0" echo "Installing OctoPrint Plugins" -~/OctoPrint/venv/bin/pip install -q "https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/latest/download/master.zip" -~/OctoPrint/venv/bin/pip install -q "https://github.com/vitormhenrique/OctoPrint-Enclosure/archive/master.zip" -~/OctoPrint/venv/bin/pip install -q "https://github.com/marian42/octoprint-preheat/archive/master.zip" -if [[ $* == *--ptg* ]] -then - ~/OctoPrint/venv/bin/pip install -q "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip" + +if [ -d "/home/pi/OctoPrint/venv" ]; then + DIRECTORY="/home/pi/OctoPrint/venv" +elif [ -d "/home/pi/oprint" ]; then + DIRECTORY="/home/pi/oprint" +else + echo "Neither /home/pi/OctoPrint/venv nor /home/pi/oprint can be found. Please specify OctoPrints full virtualenv path manually (no trailing slash):" + read DIRECTORY +fi; + +"$DIRECTORY"/bin/pip install -q "https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/latest/download/master.zip" +"$DIRECTORY"/bin/pip install -q "https://github.com/vitormhenrique/OctoPrint-Enclosure/archive/master.zip" +"$DIRECTORY"/bin/pip install -q "https://github.com/marian42/octoprint-preheat/archive/master.zip" +if [[ $* == *--ptg* ]]; then + "$DIRECTORY"/bin/pip install -q "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip" fi echo "Installing Dependencies" diff --git a/scripts/install.sh b/scripts/install.sh index 715f010dc..2d74b3152 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -3,13 +3,20 @@ release=$(curl -s "https://api.github.com/repos/UnchartedBull/OctoDash/releases/latest" | grep "browser_download_url.*armv7l.deb" | cut -d '"' -f 4) dependencies="libgtk-3-0 libnotify4 libnss3 libxss1 libxtst6 xdg-utils libatspi2.0-0 libuuid1 libappindicator3-1 libsecret-1-0 gir1.2-gnomekeyring-1.0" -echo "Installing OctoPrint Plugins" -~/OctoPrint/venv/bin/pip install -q "https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/latest/download/master.zip" -~/OctoPrint/venv/bin/pip install -q "https://github.com/vitormhenrique/OctoPrint-Enclosure/archive/master.zip" -~/OctoPrint/venv/bin/pip install -q "https://github.com/marian42/octoprint-preheat/archive/master.zip" -if [[ $* == *--ptg* ]] -then - ~/OctoPrint/venv/bin/pip install -q "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip" +if [ -d "/home/pi/OctoPrint/venv" ]; then + DIRECTORY="/home/pi/OctoPrint/venv" +elif [ -d "/home/pi/oprint" ]; then + DIRECTORY="/home/pi/oprint" +else + echo "Neither /home/pi/OctoPrint/venv nor /home/pi/oprint can be found. Please specify OctoPrints full virtualenv path manually (no trailing slash):" + read DIRECTORY +fi; + +"$DIRECTORY"/bin/pip install -q "https://github.com/OllisGit/OctoPrint-DisplayLayerProgress/releases/latest/download/master.zip" +"$DIRECTORY"/bin/pip install -q "https://github.com/vitormhenrique/OctoPrint-Enclosure/archive/master.zip" +"$DIRECTORY"/bin/pip install -q "https://github.com/marian42/octoprint-preheat/archive/master.zip" +if [[ $* == *--ptg* ]]; then + "$DIRECTORY"/bin/pip install -q "https://github.com/eyal0/OctoPrint-PrintTimeGenius/archive/master.zip" fi echo "Installing Dependencies" @@ -46,4 +53,4 @@ echo "Setting Permission" sudo chmod +x ~/.xinitrc sudo chmod ug+s /usr/lib/xorg/Xorg -echo "Done. OctoDash will start automatically on next reboot." \ No newline at end of file +echo "Done. OctoDash will start automatically on next reboot. Please ensure that auto-login is enabled." \ No newline at end of file