direct to sudoers.d
This commit is contained in:
@@ -487,17 +487,9 @@ prepare () {
|
|||||||
echo 'Adding current user to dialout and video groups.'
|
echo 'Adding current user to dialout and video groups.'
|
||||||
usermod -a -G dialout,video $user
|
usermod -a -G dialout,video $user
|
||||||
|
|
||||||
#https://gist.github.com/buchireddy/19eb6593f692852d2df7
|
echo "$user ALL=(ALL) NOPASSWD:ALL /usr/bin/systemctl" >> /etc/sudoers.d/octoprint_service
|
||||||
cp /etc/sudoers /tmp/sudoers.bak
|
echo "$user ALL=(ALL) NOPASSWD:ALL /usr/sbin/reboot" >> /etc/sudoers.d/octoprint_shutdown
|
||||||
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
|
if [ $INSTALL -eq 1 ]; then
|
||||||
echo 'Disabling unneeded services....'
|
echo 'Disabling unneeded services....'
|
||||||
systemctl disable octoprint.service
|
systemctl disable octoprint.service
|
||||||
|
|||||||
Reference in New Issue
Block a user