Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/dev_4.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bartreardon committed Apr 9, 2024
2 parents f3f7926 + bd56546 commit 45d9bfc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 44 deletions.
12 changes: 11 additions & 1 deletion MDM/Jamf Pro/service-status-ea.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@
outsetStatusRaw=$(/usr/local/outset/outset --service-status)
enabledDaemons=$(echo $outsetStatusRaw | grep -c 'Enabled$')

# If there is no user logged in, none of the 3 agents will be active, only the daemons.

expectedServices=6

currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )

if [ -z "$currentUser" -o "$currentUser" = "loginwindow" ]; then
expectedServices=3
fi

healthyStatus="Not Healthy"

if [ $enabledDaemons -eq 6 ]; then
if [ $enabledDaemons -eq $expectedServices ]; then
healthyStatus="Healthy"
fi

Expand Down
46 changes: 3 additions & 43 deletions legacy/pkgroot/usr/local/outset/outset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/local/outset/python3

"""
This script automatically processes packages, profiles, and/or scripts at
This script automatically processes packages and/or scripts at
boot, on demand, and/or login.
"""

Expand Down Expand Up @@ -35,12 +35,11 @@
import sys
import time
import warnings
from distutils.version import StrictVersion as version
from platform import mac_ver
from stat import S_IWOTH, S_IXOTH

__author__ = "Joseph Chilcote ([email protected])"
__version__ = "3.0.3"
__version__ = "3.0.4"

if not sys.warnoptions:
warnings.simplefilter("ignore")
Expand Down Expand Up @@ -232,27 +231,6 @@ def install_package(pkg):
return True


def install_profile(pathname):
"""Install mobileconfig located at given pathname"""
# profiles has new verbs in 10.13.
if version(mac_ver()[0]) >= version("10.13"):
cmd = ["/usr/bin/profiles", "install", "-path=%s" % pathname]
else:
cmd = ["/usr/bin/profiles", "-IF", pathname]

try:
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
logging.info("Installing profile %s", pathname)
(_, err) = proc.communicate()
if err:
logging.error("Failure processing %s: %s", pathname, err.decode('utf-8'))
return False
except OSError as err:
logging.error("Failure processing %s: %s", pathname, err.decode('utf-8'))
return False
return True


def run_script(pathname):
"""Runs script located at given pathname"""
logging.info("Processing %s", pathname)
Expand Down Expand Up @@ -286,7 +264,6 @@ def process_items(path, delete_items=False, once=False, override={}):
items_to_process = []
packages = []
scripts = []
profiles = []
d = {}

for dirpath, _, files in os.walk(path):
Expand All @@ -301,8 +278,6 @@ def process_items(path, delete_items=False, once=False, override={}):
if check_perms(pathname):
if pathname.lower().endswith(("pkg", "mpkg", "dmg")):
packages.append(pathname)
elif pathname.lower().endswith("mobileconfig"):
profiles.append(pathname)
else:
scripts.append(pathname)
else:
Expand Down Expand Up @@ -330,21 +305,6 @@ def process_items(path, delete_items=False, once=False, override={}):
if delete_items:
cleanup(package)

for profile in profiles:
if once:
if profile not in d:
if install_profile(profile):
d[profile] = datetime.datetime.now()
else:
if profile in override:
if override[profile] > d[profile]:
if install_profile(profile):
d[profile] = datetime.datetime.now()
else:
install_profile(profile)
if delete_items:
cleanup(profile)

for script in scripts:
if once:
if script not in d:
Expand All @@ -369,7 +329,7 @@ def main():

parser = argparse.ArgumentParser(
description="This script automatically \
processes packages, profiles, and/or scripts at boot, on demand,\
processes packages and/or scripts at boot, on demand,\
and/or login."
)
group = parser.add_mutually_exclusive_group(required=True)
Expand Down

0 comments on commit 45d9bfc

Please sign in to comment.