macadmins / installapplications

A tool for dynamically using installapplication
Apache License 2.0
286 stars 62 forks source link

for Apple Silicon, install Rosetta 2 during preinstall #79

Closed chilcote closed 3 years ago

chilcote commented 3 years ago

Not the most elegant idea, but it seems to work.

erikng commented 3 years ago

Ugh. There has to be a better way. Can you create an issue and link to this PR? I'll ping some people and get thoughts.

natewalck commented 3 years ago

Agreed. @chilcote should rewrite IAs in Swift 💩.

erikng commented 3 years ago

Doesn't Swift also have to be built for each platform?

Honestly I feel like the solution is to built a package for ARM and a package for Intel and your MDM has the ability to specify one package for each.

MDM will be able to determine the platform type before it sends an IEA command.

chilcote commented 3 years ago

A fat python compile would fix this too, as installing Rosetta could simply be done via IAs preinstall script it pulls down.

natewalck commented 3 years ago

What if we had a LaunchDaemon that did the rosetta install and then continued to load IAs LDs once that finished?

Doing this all in preinstall feels a little risky to be, considering it may not work reliably all the time.

weswhet commented 3 years ago

I like it. :shipit:

erikng commented 3 years ago

Why not a fat python install? The daemon is going to introduce a lot of complexity and we need to figure out what to do if/when the process running it also fails.

With Apple putting PRs up to python and Ronald working on pyobjc, it feels like we have a potential solution that won't increase the complexity.

natewalck commented 3 years ago

As in, python install for ARM instead of calling Rosetta? That works too.

We shouldn't trust that softwareupdate will be consistent enough for a preinstall script imo. (See: today 🤣😭)

chilcote commented 3 years ago

So to be clear, this PR isn't meant to be a permanent, stamped-in-time solution, that will forever exist and will never be replaced. But it will get IAs working on M1 Macs, for now. By all means, a fat python is the right solution, but that doesn't exist. We're allowed to iterate 🤓

natewalck commented 3 years ago

I think that is completely fair. Can we land this as a quick and dirty and then fix it more long term in a different way?

chilcote commented 3 years ago

Or leave this as a reference to others who want IAs to work on M1 Macs, until there's a proper solution. My life doesn't change whether this is merged or not 😉.

erikng commented 3 years ago

https://github.com/munki/munki/pull/1056

I like this approach, though it would likely require getting rid of the munki-pkg requirement.

chilcote commented 3 years ago

Seems overly complex to me for the problem at hand, but again, I really don't care so long as Rosetta gets installed.

MichalMMac commented 3 years ago

Munki-pkg can work with product-requirements.plist.

This could allow as to add arch requirement using munki-pkg.

Does hostArchitectures="x86_64" trigger Rosetta install or not? I am not sure about that and have no Apple Silicon Mac available to test :-(

erikng commented 3 years ago

@chilcote also needs https://github.com/munki/munki/commit/d9520b8af6fdbfe25cd562edd4efd036e7b54b7c for some use cases that aren't necessarily advertised on the README :)

chilcote commented 3 years ago

Since there's an RC for a universal python (https://www.python.org/downloads/release/python-391rc1/), I think it's probably a good idea to just cancel this PR. Folks can use it as a reference for how to get IAs on M1 Macs in the meantime