PhAzE-Variance / unRAID

unRAID Files
GNU General Public License v3.0
7 stars 3 forks source link

Filebot requires "sudoer" user #8

Closed cmer closed 8 years ago

cmer commented 8 years ago

I've been having issues trying to run Filebot from scripts and plugins I have on Unraid. The problem is that most are running as 'nobody', and 'nobody' does NOT have sudo access. After reviewing /usr/bin/filebot, I noticed that it tries to sudo every time it's run.

I made the following change and it solved the problem. I'd be great if the fix made it upstream:

#!/bin/bash                                                                                                                     
params=$@                                                                                                                       
export LD_LIBRARY_PATH="/mnt/cache/.PhAzE-Common/usr/lib:/mnt/cache/.PhAzE-Common/usr/lib64"                                    
export JAVA_HOME="/mnt/cache/.PhAzE-Common/usr/lib64/java"                                                                      
export PATH="/mnt/cache/.PhAzE-Common/usr/bin:${JAVA_HOME}/bin:$PATH"                                                           
export LC_ALL="en_US.UTF-8"                                                                                                     
export LANG="en_US.UTF-8"                                                                                                       

# Only sudo if user is sudoer                                                                                                   
`sudo -v`                                                                                                                       
if [[ $? -eq 0 ]]; then                                                                                                         
  sudo -H -u nobody /bin/bash -c ". /mnt/cache/.PhAzE-Common/Filebot/startcfg.sh; /usr/local/Filebot/filebot.sh $params"        
else                                                                                                                            
  . /mnt/cache/.PhAzE-Common/Filebot/startcfg.sh; /usr/local/Filebot/filebot.sh $params                                         
fi                                                                                                                              
PhAzE-Variance commented 8 years ago

Thanks, I'll have a look at this. Normally I assumed the filebot script would be run from the console (as root likely) but hadn't thought about it being called from another script running as a non sudoer user.

PhAzE-Variance commented 8 years ago

Script updated with recommended code.