Skip to content

InstallApplications 2.0

Compare
Choose a tag to compare
@erikng erikng released this 01 Apr 20:52
e65e5a0

Changes since RC4:

  • Fix generatejson bug daf7a75
  • Ignore built python frameworks #63

Changes:

  • Refactored to use embedded python 3.8 via Relocatable Python - #55
  • generatejson.py now uses env to figure out which python3 to run
  • Update gurl to use Munki 4.0, python 3.7 version
  • InstallApplications has moved from /Library/Application Support/installapplications to /Library/installapplications
  • Logging is now in /var/log/installapplications for both the user and root log files. Previously user logs were kept in /tmp/installapplications and lost after a reboot and root logs were in /var/log/installapplications.log

Fixes:

  • General fixes through flake8 - #56

Notes

2to3

installapplications.py and postinstall have been ran through 2to3 to automatically convert for Python3 compatibility.

Building embedded python framework

To reduce the size of the git repository, you must create your own Python. To do this, simply run the ./build_python_framework.sh script within the repository.

This process was tested on Catalina only.

./build_python_framework.sh

Cloning relocatable-python tool from github...
Cloning into '/tmp/relocatable-python-git'...
remote: Enumerating objects: 20, done.
remote: Counting objects: 100% (20/20), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 70 (delta 7), reused 16 (delta 6), pack-reused 50
Unpacking objects: 100% (70/70), done.
Downloading https://www.python.org/ftp/python/3.8.0/python-3.8.0-macosx10.9.pkg...

...

Done!
Customized, relocatable framework is at ./Python.framework
Moving Python.framework to InstallApplications payload folder

Package size increases

Unfortunately due to the embedded python, InstallApplications has significantly grown in size, from approximately 35Kb to 27.5 MB. The low size of InstallApplications has traditionally been one of it's greatest strengths, given how fragile mdmclient can be, but there is nothing that can be done here.

Pinning python user/root scripts to embedded Python

Python user/root scripts should be pinned to the embedded Python framework. Moving forward, scripts not pinned will be unsupported.

It is recommended that you run 2to3 against your scripts to make them python3 compliant.

/usr/local/bin/2to3 -w /path/to/script

Then simply update the shebang on your python scripts to pin against the InstallApplications python framework.

#!/Library/installapplications/Python.framework/Versions/3.8/bin/python3

You can find an example on how this was done by looking at InstallApplications' own postinstall