I understand the spirit of Homebrew being secure and permissions set to the owner of the device.
I've developed a workflow around scripts that pull the latest apps via brew to newly deployed machines. I have run across a newish issue where when I try and install google-drive, it prompts for a password. If I'm running the script during DEP Notify, there's no chance to enter this password.
Logs show that a password is needed to allow it to be installed, but it knows that a script is in use and just silently ends the script and moves on to the next part of the DEP Notify workflow.
tl;dr - How do I skip password prompts in brew scripts?
Here's the code that I have:
#!/bin/sh
#
# Installs a Homebrew app. Homebrew dependent for this to work.
# Use brew search <app name> to get the exact app name to use
#
# Call the Jamf value $4 here
appName="$4"
# Get the current logged in user
loggedInUser=$(stat -f%Su /dev/console)
loggedInUID=$(id -u $loggedInUser)
# Homebrew path needed
homebrewPath=$(/bin/launchctl asuser $loggedInUID sudo -iu $loggedInUser which brew)
if [ -f "$homebrewPath" ]
then
/bin/launchctl asuser $loggedInUID sudo -iu $loggedInUser $homebrewPath install $appName;
exit 0
else
echo "Homebrew not installed";
exit 1
fi
The part in particular I'm thinking I need to add some extra hooks is this line:
/bin/launchctl asuser $loggedInUID sudo -iu $loggedInUser $homebrewPath install $appName;
Anyone have any suggestions?