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

Reboot issues with macOS Sonoma #110

Open
flammable opened this issue Sep 6, 2023 · 3 comments
Open

Reboot issues with macOS Sonoma #110

flammable opened this issue Sep 6, 2023 · 3 comments

Comments

@flammable
Copy link
Contributor

Is anyone else using the reboot functionality with IAs?

We're running an older build, and with IAs set to reboot at the end of bootstrapping, we're finding Macs running macOS Sonoma beta 7 do not reboot. IAs writes to the logs that the Mac is rebooting, then IAs cleans up after itself.

Here's the relevant code:

https://github.com/macadmins/installapplications/blob/main/payload/Library/installapplications/installapplications.py#L415-L419

Running /usr/bin/osascript -e delay 5 -e tell application "System Events" to restart manually doesn't seem to do anything on macOS Sonoma beta 7, either, so I don't think this is an IAs-specific issue.

Any objection to changing this to something like /sbin/shutdown -r now instead?

@erikng
Copy link
Member

erikng commented Sep 6, 2023

If you do that, I saw IAs not able to fully clean itself up. I moved to this method to combat issues around that.

@flammable
Copy link
Contributor Author

flammable commented Sep 8, 2023

Ah, thanks. That explains the 5 second delay. Hmm.

I submitted FB13135892, but now I'm second-guessing myself. Needs more testing. This works OK on beta 7:

/usr/bin/osascript -e 'delay 5' -e 'tell application "System Events" to restart'

(it looks like I was quoting things wrong - I don't usually use osascript)

Since that's exactly what IAs is doing, I'm not sure what's wrong here.

@flammable
Copy link
Contributor Author

Because I needed to have something for today, here's what I settled on. I shoved this at the end of the script that finishes up and quits DEPNotify:

cut="/usr/bin/cut"
mv="/bin/mv"
shutdown="/sbin/shutdown"
sw_vers="/usr/bin/sw_vers"

major_os_version=$(${sw_vers} -productVersion | ${cut} -d. -f1)

if [ ${major_os_version} -ge 14 ]; then
    echo "This Mac is running macOS Sonoma or higher. Cleaning up, then rebooting."
    ${mv} "/Library/installapplications" "/tmp/"
    ${mv} "/Library/LaunchAgents/com.erikng.installapplications.plist" "/tmp/com.erikng.installapplications_agent.plist"
    ${mv} "/Library/LaunchDaemons/com.erikng.installapplications.plist" "/tmp/com.erikng.installapplications_daemon.plist"
    ${shutdown} -r now
fi

It's the last script that runs, so once the computer reboots, /tmp is cleared out, and the computer is all set up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants