From 5514b4cb7a5dffceaace7c245ffe20c01d1eb073 Mon Sep 17 00:00:00 2001 From: paukstelis Date: Wed, 23 Mar 2022 20:16:49 -0400 Subject: [PATCH] add sudoers modification --- octoprint_deploy.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/octoprint_deploy.sh b/octoprint_deploy.sh index 65d9d7f..23f3e32 100755 --- a/octoprint_deploy.sh +++ b/octoprint_deploy.sh @@ -486,6 +486,18 @@ prepare () { touch /etc/camera_ports echo 'Adding current user to dialout and video groups.' usermod -a -G dialout,video $user + + #https://gist.github.com/buchireddy/19eb6593f692852d2df7 + cp /etc/sudoers /tmp/sudoers.bak + echo "$user ALL=(ALL) NOPASSWD:ALL /usr/bin/systemctl" >> /tmp/sudoers + visudo -cf /tmp/sudoers.bak + if [ $? -eq 0 ]; then + sudo cp /tmp/sudoers.bak /etc/sudoers + echo 'Adding systemctl access to /etc/sudoers for restarting instances.' + else + echo "Could not modify /etc/sudoers file. Please do this manually." + fi + #end modify sudoers if [ $INSTALL -eq 1 ]; then echo 'Disabling unneeded services....' systemctl disable octoprint.service