Skip to content

Commit

Permalink
Merge pull request #102 from salopensource/rsr
Browse files Browse the repository at this point in the history
Support for rsr version
  • Loading branch information
grahamgilbert authored May 4, 2023
2 parents 8fc7d8b + dc9d682 commit 19b522a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ pack-sal-scripts: l_usr_local
@sudo chmod -R 755 ${WORK_D}

install: pkg
@sudo installer -pkg sal_scripts.pkg -target /
@sudo ${RM} -f /tmp/sal_scripts.pkg
@sudo ${CP} sal_scripts.pkg /tmp/sal_scripts.pkg
@sudo installer -pkg /tmp/sal_scripts.pkg -target /

pack-python: clean-python build-python
@sudo ${CP} -R Python.framework ${WORK_D}/usr/local/sal/
Expand Down
23 changes: 23 additions & 0 deletions payload/usr/local/sal/checkin_modules/machine_checkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,18 @@ def process_system_profile():
os_version = (
system_profile["SPSoftwareDataType"][0].get("os_version").split()[2]
)

machine_results["operating_system"] = os_version
machine_results["machine_model"] = system_profile["SPHardwareDataType"][0].get(
"machine_model"
)

if rsr_supported(os_version):
rsr_version = get_rsr_version()
machine_results["rsr_version"] = rsr_version
if rsr_version != "":
machine_results["operating_system"] = os_version + " " + rsr_version

udid = system_profile["SPHardwareDataType"][0].get("provisioning_UDID")
if udid is None:
# plaform_UUID was the unique id until macOS 10.15
Expand Down Expand Up @@ -96,6 +103,22 @@ def process_system_profile():
return machine_results


def rsr_supported(os_version):
major_os = os_version.split(".")[0]
if int(major_os) >= 13:
return True
return False


def get_rsr_version():
try:
return subprocess.check_output(
["/usr/bin/sw_vers", "--ProductVersionExtra"], text=True
).strip()
except:
return ""


def get_hostname():
name_type = sal.sal_pref("NameType", default="ComputerName")
net_config = SCDynamicStoreCreate(None, "net", None, None)
Expand Down
2 changes: 0 additions & 2 deletions sal_python_pkg/sal/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class SalClient:

session_class = requests.Session
_base_url = ""
_auth = None
Expand Down Expand Up @@ -94,7 +93,6 @@ def build_url(self, url):


class MacKeychainClient(SalClient):

session_class = MacSeshSession


Expand Down
2 changes: 1 addition & 1 deletion sal_python_pkg/sal/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "4.3.0"
__version__ = "4.4.0"

0 comments on commit 19b522a

Please sign in to comment.