Skip to content
New issue

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

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

Already on GitHub? # to your account

Unable to interact with parts of prompts when run via Munki on Big Sur #198

Closed
anewhouse opened this issue Feb 9, 2022 · 4 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@anewhouse
Copy link
Contributor

Describe the bug
When the erase-install script is called by Munki on an M1 Mac and it shows an AppleScript dialog, you can interact with some parts of the dialog but not others. For example, when it asks for the user's password, you can click the Enter and Stop buttons but when you try to type in the text box you hear error sounds and no text appears.

To Reproduce
Call erase-install.sh from a postinstall_script in Munki on a computer running Big Sur (does not happen in 12.2)

Expected behavior
You should be able to interact with the entire AppleScript dialog

Code/log output
Full command: /Library/Management/erase-install/erase-install.sh --erase --depnotify

Environment (please complete the following information):

  • OS: 11.6.1
  • Erase-install version 23, 24, 24.1, and 25

The fix

  • In the ask_for_shortname function, change /usr/bin/osascript to sudo -u "$current_user" /usr/bin/osascript
  • In the ask_for_password function, change /usr/bin/osascript to sudo -u "$current_user" /usr/bin/osascript
  • Add between the lines starting with “current_user=“ and "location=": current_uid=$(/usr/bin/id -u "$current_user")
  • In the open_osascript_dialog function, change /usr/bin/osascript to /bin/launchctl asuser $current_uid /usr/bin/osascript

The last two were originally to fix the dialog in free_space_check not working in v23/24 before that was moved to the separate open_osascript_dialog function but I'm pretty sure the same fix still applies, and it can't hurt to have any other dialogs run at the current user as well. There may be some other places that osascript is used but those are the ones I encountered when testing the erase-install script initially last year.

@anewhouse anewhouse added the bug Something isn't working label Feb 9, 2022
@grahampugh
Copy link
Owner

Strange that it only affects Munki-delivered versions of the script and not Jamf-delivered.

I'm also a bit confused as to why some lines require sudo -u but the other launchctl asuser. Any ideas?

@anewhouse
Copy link
Contributor Author

It's been a long time since I tested the drive space part, but I remember being surprised the same method didn't work there. But I just rolled my test machine back to Big Sur and tried it again, and it seems to work with no modifications so never mind on those last two fixes!

ask_for_shortname and ask_for_password definitely don't work without being modified, though

@grahampugh
Copy link
Owner

I've added launchctl asuser to all the osascript statements and pushed out a new pre-release version of v26.

The dialogs working for me from the command line (but then it was before). Can you test it on Munki please? I don't have a Munki setup.

@anewhouse
Copy link
Contributor Author

Thanks, I just tried all three dialogs and they work great.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants