From d3eea334f6289187fe1c0fd5803640bd10eb10a9 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Wed, 8 Jun 2022 13:11:45 -0400 Subject: [PATCH] uniquify --- README.md | 17 +++++++++-------- octoprint_deploy.sh | 12 ++++++++---- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index f1ce344..09dc1b3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Updated May 2022. +Updated June 8, 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 # octoprint_deploy @@ -22,11 +22,12 @@ As of 02/22 there is no longer a need to download a specific image file. * Continue until you have added all the printers you want to use. * haproxy entries are updated so you can connect via http://octopi.local/instancename/ (trailing slash is needed). * Please note, haproxy entries are NOT used for webcams once you use this system. Connect to them via hostname:port. -* General Linux (Ubuntu/Mint/RPiOS/Debian/Fedora/etc/) +* General Linux (Ubuntu/Mint/RPiOS/Debian/Fedora/Arch/etc.) * __You do not need to install OctoPrint using any Wiki instructions, snap, etc. The script will do it for you.__ * Basic guide video here: https://youtu.be/1YINWQ5fNn0 - * Install Ubuntu 18-22.X, Mint 20.3+, Debian, DietPi, RPiOS, Armbian, or Fedora35+ on your system (make sure your user is admin for sudo). - * Install git if it isn't already: `sudo apt install git` or `sudo dnf install git`. + * All commands assume you are operating out of your home directory. + * Install Ubuntu 18-22.X, Mint 20.3+, Debian, DietPi, RPiOS, Armbian, Fedora35+, or ArchLinux on your system (make sure your user is admin for sudo). + * Install git if it isn't already: `sudo apt install git` or `sudo dnf install git` or `sudo pacman -S git`. * run the command `git clone https://github.com/paukstelis/octoprint_deploy.git`. * run the command `sudo octoprint_deploy/octoprint_deploy.sh`. * Choose `Prepare System` from the menu. Select your distribution type. All deb-based system use the same selection. This will install necessary packages, install OctoPrint, and start a template instance. @@ -45,16 +46,16 @@ As of 02/22 there is no longer a need to download a specific image file. * Test USB connections * Want to get rid of everything? `sudo octoprint_deploy/octoprint_deploy.sh remove` # Recent Changes +* ArchLinux support * Prompt for haproxy for linux installs * Implement 'Use all defaults' for adding instances. * Prompt for streamer (mjpeg-streamer or ustreamer) -* Uniquify pnp uuid. -* Add duplicate serial number detection. +* Uniquify pnp uuid and tracking uuid's. +* Add duplicate serial number detection. There is no resolution offered as of yet. * Add architecture check to minimize errors where a system gets prepared as OctoPi when someone is using Ubuntu/Fedora/etc. * Include ustreamer as an option for camera streaming * Add remove command-line argument to get rid of all the stuff the script has done. # TODO -* Uniquify tracking ids * Cameras behind haproxy? -* Add Arch (pacman) support + diff --git a/octoprint_deploy.sh b/octoprint_deploy.sh index c4839bf..d3e593f 100755 --- a/octoprint_deploy.sh +++ b/octoprint_deploy.sh @@ -251,9 +251,6 @@ new_instance () { echo KERNELS==\"$USB\",SUBSYSTEM==\"tty\",SYMLINK+=\"octo_$INSTANCE\" >> /etc/udev/rules.d/99-octoprint.rules fi - #just to be on the safe side, add user to dialout and video - usermod -a -G dialout,video $OCTOUSER - #Append instance name to list for removal tool echo instance:$INSTANCE port:$PORT >> /etc/octoprint_instances @@ -264,6 +261,10 @@ new_instance () { cat $BFOLD/config.yaml | sed -e "s/INSTANCE/$INSTANCE/" > $OCTOCONFIG/.$INSTANCE/config.yaml #uniquify instances sed -i "s/upnpUuid: .*/upnpUuid: $(uuidgen)/" $OCTOCONFIG/.$INSTANCE/config.yaml + u1=$(uuidgen) + u2=$(uuidgen) + awk -i inplace -v id="unique_id: $u1" '/unique_id: (.*)/{c++;if(c==1){sub("unique_id: (.*)",id);}}1' $OCTOCONFIG/.$INSTANCE/config.yaml + awk -i inplace -v id="unique_id: $u2" '/unique_id: (.*)/{c++;if(c==2){sub("unique_id: (.*)",id);}}1' $OCTOCONFIG/.$INSTANCE/config.yaml #Set port sed -i "/serial:/a\ port: /dev/octo_$INSTANCE" $OCTOCONFIG/.$INSTANCE/config.yaml @@ -452,6 +453,8 @@ add_camera() { write_camera systemctl start cam_$INSTANCE.service systemctl enable cam_$INSTANCE.service + udevadm control --reload-rules + udevadm trigger main_menu fi } @@ -683,6 +686,7 @@ prepare () { #ArchLinux if [ $INSTALL -eq 4 ]; then pacman -S --noconfirm make cmake python python-virtualenv libyaml python-pip libjpeg-turbo python-yaml python-setuptools ffmpeg gcc libevent libbsd openssh haproxy v4l-utils + usermod -a -G uucp $user fi echo "Installing OctoPrint in /home/$user/OctoPrint" @@ -791,7 +795,7 @@ prepare () { fi echo 'Starting generic service on port 5000' - echo 'Connect to your template instance and setup the admin user.' + echo '\033[0;31mConnect to your template instance and setup the admin user.\033[0m' systemctl start octoprint_default.service systemctl enable octoprint_default.service echo