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

Outset 4.1.2 #53

Merged
merged 17 commits into from
Apr 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove distutils/profiles, bump
as distutils is not present in py3.12, excise all places referencing it (which was only in long-unusable code anyway as Apple doesn't allow silent profile handling)
  • Loading branch information
arubdesu committed Apr 9, 2024
commit ee29f3234a94830fba8371f91a3824fbc43a8a58
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 (chilcote@gmail.com)"
__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