From aea4c30e3e83dba253a7d8320f540d6e15d78fb0 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Sun, 21 May 2023 20:13:13 -0400 Subject: [PATCH] fix port increment issue (#88) --- octoprint_deploy.sh | 67 ++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/octoprint_deploy.sh b/octoprint_deploy.sh index 5f364a9..51c32db 100755 --- a/octoprint_deploy.sh +++ b/octoprint_deploy.sh @@ -511,14 +511,13 @@ add_camera() { read CAMPORT if [ -z "$CAMPORT" ]; then CAMPORT=$(tail -1 /etc/camera_ports) + + if [ -z "$CAMPORT" ]; then + CAMPORT=8000 + fi + CAMPORT=$((CAMPORT+1)) fi - if [ -z "$CAMPORT" ]; then - CAMPORT=8000 - fi - - CAMPORT=$((CAMPORT+1)) - if [ $CAMPORT -gt 7000 ]; then break else @@ -816,7 +815,7 @@ prepare () { sudo -u $user /home/$user/OctoPrint/bin/pip install wheel #install oprint sudo -u $user /home/$user/OctoPrint/bin/pip install OctoPrint - + #NEW! Do check to verify that OctoPrint binary is installed if [ -f "/home/$user/OctoPrint/bin/octoprint" ]; then echo "OctoPrint apppears to have been installed successfully" @@ -827,7 +826,7 @@ prepare () { remove_everything exit fi - + #start server and run in background echo 'Creating generic OctoPrint template service...' cat $SCRIPTDIR/octoprint_generic.service | \ @@ -976,38 +975,38 @@ firstrun() { echo if prompt_confirm "Do you want to setup your admin user now?"; then while true; do - echo 'Enter admin user name (no spaces): ' - read OCTOADMIN - if [ -z "$OCTOADMIN" ]; then - echo -e "No admin user given! Defaulting to: \033[0;31moctoadmin\033[0m" - OCTOADMIN=octoadmin - fi - if ! has-space "$OCTOADMIN"; then - break - else - echo "Admin user name must not have spaces." - fi + echo 'Enter admin user name (no spaces): ' + read OCTOADMIN + if [ -z "$OCTOADMIN" ]; then + echo -e "No admin user given! Defaulting to: \033[0;31moctoadmin\033[0m" + OCTOADMIN=octoadmin + fi + if ! has-space "$OCTOADMIN"; then + break + else + echo "Admin user name must not have spaces." + fi done echo "Admin user: $OCTOADMIN" - + while true; do - echo 'Enter admin user password (no spaces): ' - read OCTOPASS - if [ -z "$OCTOPASS" ]; then - echo -e "No password given! Defaulting to: \033[0;31mfooselrulz\033[0m. Please CHANGE this." - OCTOPASS=fooselrulz - fi - - if ! has-space "$OCTOPASS"; then - break - else - echo "Admin password cannot contain spaces" - fi - + echo 'Enter admin user password (no spaces): ' + read OCTOPASS + if [ -z "$OCTOPASS" ]; then + echo -e "No password given! Defaulting to: \033[0;31mfooselrulz\033[0m. Please CHANGE this." + OCTOPASS=fooselrulz + fi + + if ! has-space "$OCTOPASS"; then + break + else + echo "Admin password cannot contain spaces" + fi + done echo "Admin password: $OCTOPASS" $OCTOEXEC user add $OCTOADMIN --password $OCTOPASS --admin | log - + fi if [ -n "$OCTOADMIN" ]; then echo