diff --git a/README.md b/README.md index be3fee8..19b395e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Updated September 28, 2022. Want to support this work? Buy Me a Coffee. https://www.buymeacoffee.com/ppaukstelis. -Need help with octoprint_deploy? You can open issues here or ask on Discord: https://discord.gg/6vgSjgvR6u +Need help with octoprint_deploy? Ask on Discord: https://discord.gg/6vgSjgvR6u # octoprint_deploy These files provide a bash script for quickly deploying multiple octoprint instances on a single computer. For Linux systems (Ubuntu, Fedora, etc.) it will also install OctoPrint and a video streamer (mjpg-streamer or ustreamer). No need for lots of file editing or complicated Docker compose scripts! @@ -39,13 +39,13 @@ These files provide a bash script for quickly deploying multiple octoprint insta * You will be prompted if you want to setup the admin user and do the first run wizard via the commandline. If you do this now you can start making new instances as soon as the system preparation is complete. * You will be prompted if you want to install recommended plugins and cloud plugins. This can be useful if you want to configure plugins in your template instance, before adding new instances. * If you didn't setup admin user in the step above, setup admin user by connecting to your system (either http://localhost:5000 or http://[hostname]:5000 via a browser - * __This instance is just a generic template used for making all your other instances. You need to make at least one instance using the script when this is done. Do not add a camera to the generic instance.__ + * __This instance is just a generic template used for making all your other instances. You need to make at least one instance using the script when this is done.__ * Continue with octoprint_deploy script, choose `New Instance` and follow the instructions. * Do not plug the printer in by USB until you are asked to do so. - * If your printer does not have a serial number (all Creality printers) it will detect by the USB port you plugged it in to. + * If your printer does not have a serial number (all Creality printers) it will be detected by the USB port you plugged it in to. * After adding the first instance, the template instance will be shutdown. This is normal. * Add as many instances as you have printers, following the instructions. - * To add more printers at a later date, or to add cameras to an instance if you did not do that while setting up the printers, simply run the script again (`sudo octoprint_deploy/octoprint_deploy.sh`) and choose the appropriate options. + * To add more printers at a later date, or to add cameras to an instance, simply run the script again (`sudo octoprint_deploy/octoprint_deploy.sh`) and choose the appropriate options. * Remember, camera installed with this script are experimental and always will be. The script makes some basic assumptions that you may need to change later. Cameras suck up quite a bit of USB bandwidth so while it is quite straightforward to run 10 printers with a modest computer, you can't also run 10 cameras. * What else can you do? * Remove instances @@ -57,6 +57,7 @@ These files provide a bash script for quickly deploying multiple octoprint insta * Change udev rules for an instance with `sudo octoprint_deploy/octoprint_deploy.sh replace` # Recent Changes * 0.1.3, printer and camera detection now done with dmesg instead of journalctl. This allows faster timeouts when a device is detected by the USB port but it does not have a serial number. +* Fail if sudouser is root. * Write /etc/octoprint_deploy if missing (older version system preparation) * Add option for plugin installation during system preparation. * Enable ssh. diff --git a/octoprint_deploy.sh b/octoprint_deploy.sh index e2cfa2f..55552bd 100755 --- a/octoprint_deploy.sh +++ b/octoprint_deploy.sh @@ -6,8 +6,9 @@ if (( $EUID != 0 )); then exit fi -#this is a weak check, but while catch most cases -if [ "$USER" == root ]; then +#this is a weak check, but will catch most cases +if [ $SUDO_USER ]; then user=$SUDO_USER; fi +if [ "$user" == root ]; then echo "You should not run this script as root. Use sudo as a normal user" exit fi @@ -1150,7 +1151,6 @@ main_menu() { done } # initiate logging -if [ $SUDO_USER ]; then user=$SUDO_USER; fi logfile='octoprint_deploy.log' SCRIPTDIR=$(dirname $(readlink -f $0)) source $SCRIPTDIR/plugins.sh