Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mac OS] Fix logic for retrying AppleScript execution #8662

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions images/macos/provision/core/commonutils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,20 @@ fi
# System Preferences -> Security & Privacy -> General -> Unlock -> Allow -> Not now
if is_Monterey; then
if is_Veertu; then
echo "Executing AppleScript to change security preferences (with retries)"
retry=5
while [ $retry -gt 0 ]; do
for retry in {4..0}; do
echo "Executing AppleScript to change security preferences. Retries left: $retry"
{
set -e
osascript -e 'tell application "System Events" to get application processes where visible is true'
}
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
osascript $HOME/utils/confirm-identified-developers.scpt $USER_PASSWORD
} && break

retry=$((retry-1))
echo "retries left "$retry
if [ "$retry" -eq 0 ]; then
echo "Executing AppleScript failed. No retries left"
exit 1
fi

echo "Executing AppleScript failed. Sleeping for 10 seconds and retrying"
sleep 10
done
else
Expand Down