Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Choose which python to use from some popular options, in this order:
Browse files Browse the repository at this point in the history
  1. python.org https://www.python.org/downloads/
  2. MacAdmins https://github.com/macadmins/python
  3. Munki https://github.com/munki/munki
 If none of these are on disk, then fall back to Apple's system python,
 which can be installed via the Command Line Tools.

 "What about python 2, which Apple still ships," you ask?
  Outset does not support python 2, which was sunsetted on Jan 1, 2020.
  See https://www.python.org/doc/sunset-python-2/.
  If you choose to continue to use python 2, you'll want to create the symlink via other means,
  with something like: /bin/ln -s /usr/bin/python /usr/local/outset/python3
  • Loading branch information
chilcote committed Jul 11, 2020
1 parent cd8a8f1 commit cbb541c
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKGTITLE="outset"
PKGVERSION="3.0.0"
PKGVERSION="3.0.1"
PKGID=com.github.outset
PROJECT="outset"

Expand Down
4 changes: 2 additions & 2 deletions pkgroot/usr/local/outset/outset
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python3
#!/usr/local/outset/python3

"""
This script automatically processes packages, profiles, and/or scripts at
Expand Down Expand Up @@ -40,7 +40,7 @@ from platform import mac_ver
from stat import S_IWOTH, S_IXOTH

__author__ = "Joseph Chilcote ([email protected])"
__version__ = "3.0.0"
__version__ = "3.0.1"

if not sys.warnoptions:
warnings.simplefilter("ignore")
Expand Down
37 changes: 36 additions & 1 deletion scripts/postinstall
Original file line number Diff line number Diff line change
@@ -1,12 +1,47 @@
#!/bin/bash
# reference: https://github.com/google/macops/blob/master/keychainminder/Package/postinstall
set -x

# Only proceed if we are installing on the booted volume
[[ $3 != "/" ]] && exit 0

# Let's play python roulette, and choose from some popular options, in this order:
# 1. python.org https://www.python.org/downloads/
# 2. MacAdmins https://github.com/macadmins/python
# 3. Munki https://github.com/munki/munki
# If none of these are on disk, then fall back to Apple's system python,
# which can be installed via the Command Line Tools.

# "What about python 2, which Apple still ships," you ask?
# Outset does not support python 2, which was sunsetted on Jan 1, 2020.
# See https://www.python.org/doc/sunset-python-2/.
# If you choose to continue to use python 2, you'll want to create the symlink via other means,
# with something like: /bin/ln -s /usr/bin/python /usr/local/outset/python3

OUTSET_PYTHON=/usr/local/outset/python3
ORG_PYTHON=/usr/local/bin/python3
MACADMINS_PYTHON=/usr/local/bin/managed_python3
MUNKI_PYTHON=/usr/local/munki/python
SYSTEM_PYTHON=/usr/bin/python3

# Delete existing symlink
[[ -L "${OUTSET_PYTHON}" ]] && /bin/rm "${OUTSET_PYTHON}"

if [[ -L "${ORG_PYTHON}" ]]; then
/bin/ln -s "${ORG_PYTHON}" "${OUTSET_PYTHON}"
elif [[ -L "${MACADMINS_PYTHON}" ]]; then
/bin/ln -s "${MACADMINS_PYTHON}" "${OUTSET_PYTHON}"
elif [[ -L "${MUNKI_PYTHON}" ]]; then
/bin/ln -s "${MUNKI_PYTHON}" "${OUTSET_PYTHON}"
else
/bin/ln -s "${SYSTEM_PYTHON}" "${OUTSET_PYTHON}"
fi

# Load the LaunchDaemons
/bin/launchctl load /Library/LaunchDaemons/com.github.outset.boot.plist
/bin/launchctl load /Library/LaunchDaemons/com.github.outset.cleanup.plist
/bin/launchctl load /Library/LaunchDaemons/com.github.outset.login-privileged.plist

# Load the LaunchAgents
user=$(/bin/echo "show State:/Users/ConsoleUser" | /usr/sbin/scutil | /usr/bin/awk '/Name :/&&!/loginwindow/{print $3}')
[[ -z "$user" ]] && exit 0
/bin/launchctl asuser "$user" /bin/launchctl load /Library/LaunchAgents/com.github.outset.login.plist
Expand Down

0 comments on commit cbb541c

Please sign in to comment.