2 weeks ago
Hi Nation,
We have an issue with keychain while we are trying to make google chrome as a default browser via our prestage script. So, basically we have two scripts:
1. PreStage script (trigger set to immediately after the enrollment)
2. Script 1 enables another trigger which sets google chrome as a default browser.
We are using Jamf setup manager to install chrome.
The first script looks like this
#!/bin/bash
# Initial PreStage Script
# This script runs a manual policy trigger to
# allow the policy or policies associated with that
# trigger to be executed.
waitForSetupToFinish() {
# Wait until setup is complete and the user is logged in.
logToFile "Waiting for Setup to complete"
currentUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
while ( [[ $currentUser == "_mbsetupuser" || $currentUser == "loginwindow" ]] || ! ( (pgrep -x "Dock") && (pgrep -x "Finder") ) ) ; do
# echo "User is not logged in and at Finder"
sleep 5
currentUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
# echo $currentUser
done
}
waitForSetupToFinish
trigger1=defaultchrome
CheckBinary (){
# Identify location of jamf binary.
jamf_binary=`/usr/bin/which jamf`
if [[ "$jamf_binary" == "" ]] && [[ -x "/usr/sbin/jamf" ]] && [[ ! -x "/usr/local/bin/jamf" ]]; then
jamf_binary="/usr/sbin/jamf"
elif [[ "$jamf_binary" == "" ]] && [[ ! -x "/usr/sbin/jamf" ]] && [[ -x "/usr/local/bin/jamf" ]]; then
jamf_binary="/usr/local/bin/jamf"
elif [[ "$jamf_binary" == "" ]] && [[ -x "/usr/sbin/jamf" ]] && [[ -x "/usr/local/bin/jamf" ]]; then
jamf_binary="/usr/local/bin/jamf"
fi
}
# Run the CheckBinary function to identify the location
# of the jamf binary for the jamf_binary variable.
CheckBinary
sudo $jamf_binary policy -trigger "$trigger1"
sudo $jamf_binary recon
The trigger defaultchrome initiates the second script which will open chrome and sets it as a default browser:
#!/bin/zsh
# DefaultBrowser.sh
open -a "Google Chrome" --new --args --make-default-browser
Now, the issue is, after performing the execution, we are getting the following error that keychain not found:
Now we have no idea what's trigerring this issue. When we run it via self service, everything works fine. But this issue occurs when it is enrolled via prestage enrollment.
I guess something is wrong with the first script. Can anyone shed some light for the solution?
Thanks in advance 😊
2 weeks ago - last edited 2 weeks ago
@rabiul JSM isn't running as your user when it's part of the PreStage so you can't set the default browser at that point. You'll need to set up a policy to run the script that sets the default browser after the user has logged in.
2 weeks ago
I guess, there was no user logged in when this script was executed. try to execute this script once the user logged in to the Mac.