├── source ├── .gitattributes ├── SapMachine Manager │ ├── Assets.xcassets │ │ ├── Contents.json │ │ ├── AppIcon.appiconset │ │ │ ├── AppIcon-16.png │ │ │ ├── AppIcon-32.png │ │ │ ├── AppIcon-64.png │ │ │ ├── AppIcon-1024.png │ │ │ ├── AppIcon-128.png │ │ │ ├── AppIcon-256.png │ │ │ ├── AppIcon-512.png │ │ │ └── Contents.json │ │ └── AccentColor.colorset │ │ │ └── Contents.json │ ├── SapMachine_Manager.entitlements │ ├── Info.plist │ ├── Classes │ │ ├── MTTableView.h │ │ ├── MTToolbarItem.h │ │ ├── MTTableCellView.h │ │ ├── MTStoryboardSegue.h │ │ ├── MTStoryboardAnimator.h │ │ ├── MTMainWindowController.m │ │ ├── MTStoryboardSegue.m │ │ ├── MTMainWindowController.h │ │ ├── MTTableCellView.m │ │ ├── MTToolbarItem.m │ │ ├── MTStoryboardAnimator.m │ │ ├── MTDaemonConnection.h │ │ └── MTTableView.m │ ├── AppDelegate.h │ ├── View Controllers │ │ ├── MTLogDetailsController.h │ │ ├── MTSettingsGeneralController.h │ │ ├── MTLogController.h │ │ ├── MTSettingsTabViewController.h │ │ ├── MTConsoleSplitViewController.h │ │ ├── MTPackageIntroController.h │ │ ├── MTInstallIntroController.h │ │ ├── MTPackageArchSelectController.h │ │ ├── MTPackageReleaseSelectController.h │ │ ├── MTMainViewController.h │ │ ├── MTInstallController.h │ │ ├── MTPackageBuildController.h │ │ ├── MTLogDetailsController.m │ │ ├── MTPackageIntroController.m │ │ ├── MTConsoleSplitViewController.m │ │ ├── MTPackageArchSelectController.m │ │ ├── MTSettingsTabViewController.m │ │ ├── MTSettingsGeneralController.m │ │ ├── MTInstallIntroController.m │ │ └── MTInstallController.m │ ├── de.lproj │ │ └── Credits.rtf │ ├── main.m │ ├── Base.lproj │ │ └── Credits.rtf │ ├── corp.sap.SMUDaemon.plist │ ├── SupportedShells.plist │ ├── Value Transformers │ │ ├── MTReleaseNameTransformer.h │ │ ├── MTReleaseImageTransformer.h │ │ ├── MTReleaseStatusTransformer.h │ │ ├── MTLogLevelValueTransformer.h │ │ ├── MTReleaseStatusToolTipTransformer.h │ │ ├── MTDefaultEnvironmentImageTransformer.h │ │ ├── MTLabelTextTransformer.h │ │ ├── MTButtonTitleTransformer.h │ │ ├── MTDefaultEnvironmentToolTipTransformer.h │ │ ├── MTButtonTitleTransformer.m │ │ ├── MTReleaseNameTransformer.m │ │ ├── MTDefaultEnvironmentToolTipTransformer.m │ │ ├── MTLabelTextTransformer.m │ │ ├── MTDefaultEnvironmentImageTransformer.m │ │ ├── MTReleaseImageTransformer.m │ │ ├── MTReleaseStatusTransformer.m │ │ ├── MTReleaseStatusToolTipTransformer.m │ │ └── MTLogLevelValueTransformer.m │ ├── AppIcon.icon │ │ ├── Assets │ │ │ └── l2.svg │ │ └── icon.json │ ├── InfoPlist.xcstrings │ ├── postinstall.txt │ ├── AppDelegate.m │ └── SapMachine Manager.mobileconfig ├── SapMachine Manager.xcodeproj │ ├── .DS_Store │ ├── xcuserdata │ │ └── .DS_Store │ ├── project.xcworkspace │ │ ├── .DS_Store │ │ ├── xcuserdata │ │ │ └── .DS_Store │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ ├── SMUDaemon.xcscheme │ │ └── SapMachine Manager.xcscheme ├── SapMachineXPC │ ├── Info.plist │ ├── Localizable.xcstrings │ ├── SapMachineXPC.h │ ├── main.m │ ├── SapMachineXPCProtocol.h │ └── SapMachineXPC.m ├── SMUDaemon │ ├── SMUDaemon-Info.plist │ ├── SMUDaemon.h │ ├── MTCodeSigning.h │ ├── main.m │ └── MTCodeSigning.m └── Shared │ ├── Classes │ ├── MTSapMachineDownload.m │ ├── MTOperationQueue.m │ ├── MTChecksum.h │ ├── MTOperationQueue.h │ ├── MTChecksum.m │ ├── MTSapMachineDownload.h │ ├── MTSystemInfo.h │ ├── MTSapMachineUser.m │ ├── MTSapMachineUser.h │ ├── MTSapMachineVersion.h │ ├── MTSystemInfo.m │ ├── MTJavaHome.h │ ├── MTSapMachineVersion.m │ ├── MTSapMachine.h │ └── MTSapMachineAsset.h │ └── Constants.h ├── readme_images ├── logviewer.png ├── first_launch.png ├── smm_launched.png ├── install_manual.png ├── settings_general.png ├── smm_main_window.png ├── install_recommended.png ├── release_delete_menu.png ├── UninstallationWindow.png ├── package_create_finish.png ├── package_create_intro.png ├── package_create_success.png ├── release_delete_context.png ├── package_create_jvm_select.png ├── package_create_mac_select.png ├── package_create_script2pkg.png └── sapmachinemanager_banner_github.png ├── REUSE.toml ├── CONTRIBUTING.md ├── README.md └── application_management └── example_profile └── SapMachine Install Manager.mobileconfig /source/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /readme_images/logviewer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/logviewer.png -------------------------------------------------------------------------------- /readme_images/first_launch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/first_launch.png -------------------------------------------------------------------------------- /readme_images/smm_launched.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/smm_launched.png -------------------------------------------------------------------------------- /readme_images/install_manual.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/install_manual.png -------------------------------------------------------------------------------- /readme_images/settings_general.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/settings_general.png -------------------------------------------------------------------------------- /readme_images/smm_main_window.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/smm_main_window.png -------------------------------------------------------------------------------- /readme_images/install_recommended.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/install_recommended.png -------------------------------------------------------------------------------- /readme_images/release_delete_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/release_delete_menu.png -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /readme_images/UninstallationWindow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/UninstallationWindow.png -------------------------------------------------------------------------------- /readme_images/package_create_finish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/package_create_finish.png -------------------------------------------------------------------------------- /readme_images/package_create_intro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/package_create_intro.png -------------------------------------------------------------------------------- /readme_images/package_create_success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/package_create_success.png -------------------------------------------------------------------------------- /readme_images/release_delete_context.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/release_delete_context.png -------------------------------------------------------------------------------- /readme_images/package_create_jvm_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/package_create_jvm_select.png -------------------------------------------------------------------------------- /readme_images/package_create_mac_select.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/package_create_mac_select.png -------------------------------------------------------------------------------- /readme_images/package_create_script2pkg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/package_create_script2pkg.png -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager.xcodeproj/.DS_Store -------------------------------------------------------------------------------- /readme_images/sapmachinemanager_banner_github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/readme_images/sapmachinemanager_banner_github.png -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/xcuserdata/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager.xcodeproj/xcuserdata/.DS_Store -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/project.xcworkspace/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager.xcodeproj/project.xcworkspace/.DS_Store -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-16.png -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-32.png -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-64.png -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/project.xcworkspace/xcuserdata/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager.xcodeproj/project.xcworkspace/xcuserdata/.DS_Store -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-1024.png -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-128.png -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-256.png -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SAP/sapmachine-manager-for-macos/HEAD/source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/AppIcon-512.png -------------------------------------------------------------------------------- /source/SapMachine Manager/SapMachine_Manager.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | LSHasLocalizedDisplayName 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /source/SapMachineXPC/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | XPCService 6 | 7 | JoinExistingSession 8 | 9 | ServiceType 10 | Application 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /source/SapMachineXPC/Localizable.xcstrings: -------------------------------------------------------------------------------- 1 | { 2 | "sourceLanguage" : "en", 3 | "strings" : { 4 | "authDialogMessage" : { 5 | "localizations" : { 6 | "de" : { 7 | "stringUnit" : { 8 | "state" : "translated", 9 | "value" : "SapMachine Manager möchte Änderungen an den auf Ihrem Mac installierten SapMachine-Versionen vornehmen." 10 | } 11 | }, 12 | "en" : { 13 | "stringUnit" : { 14 | "state" : "translated", 15 | "value" : "SapMachine Manager wants to make changes to the SapMachine releases installed on your Mac." 16 | } 17 | } 18 | } 19 | } 20 | }, 21 | "version" : "1.0" 22 | } -------------------------------------------------------------------------------- /source/SMUDaemon/SMUDaemon-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | corp.sap.SMUDaemon 7 | CFBundleInfoDictionaryVersion 8 | 6.0 9 | CFBundleName 10 | SMUDaemon 11 | CFBundleShortVersionString 12 | $(MARKETING_VERSION) 13 | CFBundleVersion 14 | $(CURRENT_PROJECT_VERSION) 15 | NSHumanReadableCopyright 16 | Copyright © 2023-2025 SAP SE. All rights reserved. 17 | 18 | 19 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTTableView.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTTableView.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTTableView : NSTableView 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTToolbarItem.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTToolbarItem.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTToolbarItem : NSToolbarItem 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTTableCellView.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTTableCellView.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTTableCellView : NSTableCellView 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachineDownload.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachineDownload.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTSapMachineDownload.h" 19 | 20 | @implementation MTSapMachineDownload 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | AppDelegate.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface AppDelegate : NSObject 21 | 22 | 23 | @end 24 | 25 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTStoryboardSegue.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTStoryboardSegue.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTStoryboardSegue : NSStoryboardSegue 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTLogDetailsController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTLogDetailsController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTLogDetailsController : NSViewController 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTSettingsGeneralController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSettingsGeneralController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTSettingsGeneralController : NSViewController 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachineXPC/SapMachineXPC.h: -------------------------------------------------------------------------------- 1 | /* 2 | SapMachineXPC.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "SapMachineXPCProtocol.h" 20 | 21 | @interface SapMachineXPC : NSObject 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTLogController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTLogController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTLogController : NSViewController 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/de.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf2758 2 | \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 SFPro-Regular;} 3 | {\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue0;} 4 | {\*\expandedcolortbl;;\cssrgb\c0\c0\c0\c49804\cname secondaryLabelColor;\csgray\c0\c0;} 5 | \paperw11900\paperh16840\vieww20740\viewh8340\viewkind0 6 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc\partightenfactor0 7 | 8 | \f0\fs20 \cf2 \cb3 \ 9 | Idee, Design & Entwicklung\ 10 | Marc Thielemann\ 11 | \ 12 | \pard\pardeftab720\qc\partightenfactor0 13 | \cf2 \expnd0\expndtw0\kerning0 14 | Diese Anwendung kann unter der\ 15 | {\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0"}}{\fldrslt \kerning1\expnd0\expndtw0 Apache Lizenz, Version 2.0}}\ 16 | weitergegeben und modifiziert werden.\ 17 | } -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTSettingsTabViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSettingsTabViewController.h 3 | Copyright 2022-2023 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTSettingsTabViewController : NSTabViewController 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | main.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | int main(int argc, const char * argv[]) { 21 | 22 | @autoreleasepool { 23 | 24 | } 25 | 26 | return NSApplicationMain(argc, argv); 27 | } 28 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "color" : { 5 | "color-space" : "srgb", 6 | "components" : { 7 | "alpha" : "1.000", 8 | "blue" : "211", 9 | "green" : "143", 10 | "red" : "0" 11 | } 12 | }, 13 | "idiom" : "universal" 14 | }, 15 | { 16 | "appearances" : [ 17 | { 18 | "appearance" : "luminosity", 19 | "value" : "dark" 20 | } 21 | ], 22 | "color" : { 23 | "color-space" : "srgb", 24 | "components" : { 25 | "alpha" : "1.000", 26 | "blue" : "1.000", 27 | "green" : "0.667", 28 | "red" : "0.059" 29 | } 30 | }, 31 | "idiom" : "universal" 32 | } 33 | ], 34 | "info" : { 35 | "author" : "xcode", 36 | "version" : 1 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTConsoleSplitViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTConsoleSplitViewController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTConsoleSplitViewController : NSSplitViewController 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Base.lproj/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf2758 2 | \cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fnil\fcharset0 SFPro-Regular;} 3 | {\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red0\green0\blue0;} 4 | {\*\expandedcolortbl;;\cssrgb\c0\c0\c0\c49804\cname secondaryLabelColor;\csgray\c0\c0;} 5 | \paperw11900\paperh16840\vieww20740\viewh8340\viewkind0 6 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc\partightenfactor0 7 | 8 | \f0\fs20 \cf2 \cb3 \ 9 | Idea, Design & Engineering\ 10 | Marc Thielemann\ 11 | \ 12 | \pard\pardeftab720\qc\partightenfactor0 13 | \cf2 \expnd0\expndtw0\kerning0 14 | This application can be redistributed\ 15 | and modified under \kerning1\expnd0\expndtw0 the\ 16 | {\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0"}}{\fldrslt Apache License, Version 2.0}}\expnd0\expndtw0\kerning0 17 | \ 18 | } -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTStoryboardAnimator.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTStoryboardAnimator.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import 20 | 21 | @interface MTStoryboardAnimator : NSObject 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /source/SapMachine Manager/corp.sap.SMUDaemon.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | MachServices 6 | 7 | corp.sap.SapMachineManager.xpc 8 | 9 | 10 | Label 11 | corp.sap.sapmachine.daemon 12 | Program 13 | /Applications/SapMachine Manager.app/Contents/MacOS/SMUDaemon 14 | AssociatedBundleIdentifiers 15 | corp.sap.SapMachineManager 16 | StartInterval 17 | 7200 18 | RunAtLoad 19 | 20 | SpawnConstraint 21 | 22 | team-identifier 23 | 7R5ZEU67FQ 24 | signing-identifier 25 | corp.sap.SMUDaemon 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /source/SapMachine Manager/SupportedShells.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | /bin/bash 6 | 7 | system 8 | 9 | /etc/profile 10 | 11 | user 12 | 13 | .bash_profile 14 | .bashrc 15 | .profile 16 | .bash_login 17 | 18 | 19 | /bin/zsh 20 | 21 | system 22 | 23 | /etc/zshenv 24 | /etc/zprofile 25 | /etc/zshrc 26 | 27 | user 28 | 29 | .zshenv 30 | .zprofile 31 | .zshrc 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTPackageIntroController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTPackageIntroController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTPackageIntroController : NSViewController 21 | 22 | @property (nonatomic, strong, readwrite) NSArray *assetCatalog; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTMainWindowController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTMainWindowController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTMainWindowController.h" 19 | 20 | @implementation MTMainWindowController 21 | 22 | - (void)windowWillClose:(NSNotification *)notification 23 | { 24 | [NSApp terminate:self]; 25 | } 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTInstallIntroController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTInstallIntroController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTInstallIntroController : NSViewController 21 | 22 | @property (nonatomic, strong, readwrite) NSArray *assetCatalog; 23 | @property (assign) BOOL skipRecommended; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTPackageArchSelectController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTPackageArchSelectController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "MTSapMachineAsset.h" 20 | 21 | @interface MTPackageArchSelectController : NSViewController 22 | 23 | @property (nonatomic, strong, readwrite) MTSapMachineAsset *selectedAsset; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTPackageReleaseSelectController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTPackageReleaseSelectController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | @interface MTPackageReleaseSelectController : NSViewController 21 | 22 | @property (nonatomic, strong, readwrite) NSArray *assetCatalog; 23 | @property (assign) BOOL isInstall; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTMainViewController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTMainViewController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "MTSapMachine.h" 20 | #import "MTDaemonConnection.h" 21 | 22 | @interface MTMainViewController : NSViewController 23 | 24 | @end 25 | 26 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTStoryboardSegue.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTStoryboardSegue.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTStoryboardSegue.h" 19 | #import "MTStoryboardAnimator.h" 20 | 21 | @implementation MTStoryboardSegue 22 | 23 | - (void)perform { 24 | [[self sourceController] presentViewController:[self destinationController] animator:[[MTStoryboardAnimator alloc] init]]; 25 | } 26 | @end 27 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTInstallController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTInstallController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "MTSapMachineAsset.h" 20 | #import "MTDaemonConnection.h" 21 | 22 | @interface MTInstallController : NSViewController 23 | 24 | @property (nonatomic, strong, readwrite) MTSapMachineAsset *selectedAsset; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTMainWindowController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTMainWindowController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTMainWindowController 22 | @abstract A sublass of NSWindowController that terminates the app as soon as the 23 | window controller's window has been closed. 24 | */ 25 | @interface MTMainWindowController : NSWindowController 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTPackageBuildController.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTPackageBuildController.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "MTSapMachineAsset.h" 20 | #import "MTDaemonConnection.h" 21 | 22 | @interface MTPackageBuildController : NSViewController 23 | 24 | @property (nonatomic, strong, readwrite) MTSapMachineAsset *selectedAsset; 25 | @property (assign) NSInteger selectedArchitecture; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseNameTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseNameTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTReleaseNameTransformer 22 | @abstract A value transformer that returns a string that consists of the given 23 | MTSapMachineAsset's display name with the asset's type (jre or jdk) 24 | appended. 25 | */ 26 | 27 | @interface MTReleaseNameTransformer : NSValueTransformer 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTOperationQueue.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTOperationQueue.m 3 | Copyright 2022-2023 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTOperationQueue.h" 19 | 20 | @implementation MTOperationQueue 21 | 22 | - (void)addNotificationBlock:(void (^) (void))block 23 | { 24 | if (block) { 25 | 26 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 27 | 28 | [self waitUntilAllOperationsAreFinished]; 29 | dispatch_async(dispatch_get_main_queue(), ^{ block(); }); 30 | }); 31 | } 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /source/SMUDaemon/SMUDaemon.h: -------------------------------------------------------------------------------- 1 | /* 2 | SMUDaemon.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "SMUDaemonProtocol.h" 20 | 21 | @interface SMUDaemon : NSObject 22 | 23 | @property (nonatomic, strong, readwrite) id updateDelegate; 24 | @property (assign, readonly) BOOL operationInProgress; 25 | @property (assign) BOOL shouldTerminate; 26 | 27 | - (void)invalidateXPC; 28 | - (NSInteger)numberOfActiveXPCConnections; 29 | - (NSDate*)lastSuccessfulCheck; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseImageTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseImageTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTReleaseImageTransformer 22 | @abstract A value transformer that returns an image of a triange with an exclamation 23 | mark if the given MTSapMachineAsset's installed version is lower than the 24 | current version. Otherwise returns an image of a circle with a checkmark. 25 | */ 26 | 27 | @interface MTReleaseImageTransformer : NSValueTransformer 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseStatusTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseStatusTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | 21 | /*! 22 | @class MTReleaseStatusTransformer 23 | @abstract A value transformer that returns the localized string "statusUpdateAvailable" 24 | if the given MTSapMachineAsset's installed version is lower than the current 25 | version. Otherwise returns the localized string "statusUpToDate". 26 | */ 27 | 28 | @interface MTReleaseStatusTransformer : NSValueTransformer 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTLogLevelValueTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTLogLevelValueTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTLogLevelValueTransformer 22 | @abstract A value transformer that returns an image of a filled yellow circle 23 | if the given OSLogEntryLog is of level OSLogEntryLogLevelError 24 | or an image of a filled red circle if the given OSLogEntryLog is of 25 | level OSLogEntryLogLevelFault. 26 | */ 27 | 28 | @interface MTLogLevelValueTransformer : NSValueTransformer 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseStatusToolTipTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseImageTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTReleaseStatusToolTipTransformer 22 | @abstract A value transformer that returns the localized string "statusToolTipUpdateAvailable" 23 | if the given MTSapMachineAsset's installed version is lower than the current version. 24 | Otherwise returns the localized string "statusToolTipUpToDate". 25 | */ 26 | 27 | @interface MTReleaseStatusToolTipTransformer : NSValueTransformer 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTDefaultEnvironmentImageTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTDefaultEnvironmentImageTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTDefaultEnvironmentImageTransformer 22 | @abstract A value transformer that returns an image of a house if the given MTSapMachineAsset 23 | is used as the default Java environment for the current user only. If it has been set 24 | system-wide it returns an image of a filled house. 25 | */ 26 | 27 | @interface MTDefaultEnvironmentImageTransformer : NSValueTransformer 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTLabelTextTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTLabelTextTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTLabelTextTransformer 22 | @abstract A value transformer that returns the localized string "noUpdatesAvailable" 23 | if the integer value of the given value is 0. It returns the localized string 24 | "oneUpdateAvailable" if the value is 1 and "multipleUpdatesAvailable" 25 | if the value is greater than 1. 26 | */ 27 | 28 | @interface MTLabelTextTransformer : NSValueTransformer 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTButtonTitleTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTButtonTitleTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTButtonTitleTransformer 22 | @abstract A value transformer that returns the localized string "checkButtonTitle" 23 | if the integer value of the given value is 0. It returns the localized string 24 | "installOneButtonTitle" if the value is 1 and "installMultipleButtonTitle" 25 | if the value is greater than 1. 26 | */ 27 | 28 | @interface MTButtonTitleTransformer : NSValueTransformer 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTDefaultEnvironmentToolTipTransformer.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTDefaultEnvironmentToolTipTransformer.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTDefaultEnvironmentToolTipTransformer 22 | @abstract A value transformer that returns an image of a house if the given MTSapMachineAsset 23 | is used as the default Java environment for the current user only. If it has been set 24 | system-wide it returns an image of a filled house. 25 | */ 26 | 27 | @interface MTDefaultEnvironmentToolTipTransformer : NSValueTransformer 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTTableCellView.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTTableCellView.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTTableCellView.h" 19 | 20 | @implementation MTTableCellView 21 | 22 | - (void)drawRect:(NSRect)dirtyRect 23 | { 24 | [super drawRect:dirtyRect]; 25 | 26 | NSString *imageName = [[[self imageView] image] accessibilityDescription]; 27 | NSColor *tintColor = [NSColor systemRedColor]; 28 | 29 | if ([imageName isEqualToString:@"checkmark.circle"]) { 30 | 31 | tintColor = [NSColor systemGreenColor]; 32 | 33 | } else if ([imageName isEqualToString:@"questionmark.square"]) { 34 | 35 | tintColor = [NSColor systemOrangeColor]; 36 | } 37 | 38 | [[self imageView] setContentTintColor:tintColor]; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTButtonTitleTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTButtonTitleTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTButtonTitleTransformer.h" 19 | 20 | @implementation MTButtonTitleTransformer 21 | 22 | + (BOOL)allowsReverseTransformation 23 | { 24 | return NO; 25 | } 26 | 27 | - (id)transformedValue:(id)value 28 | { 29 | NSString *buttonText = NSLocalizedString(@"checkButtonTitle", nil); 30 | NSInteger updateCount = [value integerValue]; 31 | 32 | if (updateCount == 1) { 33 | 34 | buttonText = NSLocalizedString(@"installOneButtonTitle", nil); 35 | 36 | } else if (updateCount > 1) { 37 | 38 | buttonText = NSLocalizedString(@"installMultipleButtonTitle", nil); 39 | } 40 | 41 | return buttonText; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseNameTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseNameTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTReleaseNameTransformer.h" 19 | #import "MTSapMachineAsset.h" 20 | #import "Constants.h" 21 | 22 | @implementation MTReleaseNameTransformer 23 | 24 | + (BOOL)allowsReverseTransformation 25 | { 26 | return NO; 27 | } 28 | 29 | - (id)transformedValue:(id)value 30 | { 31 | MTSapMachineAsset *asset = (MTSapMachineAsset*)value; 32 | NSString *jvmType = ([asset jvmType] == MTSapMachineJVMTypeJRE) ? kMTJVMTypeJRE : kMTJVMTypeJDK; 33 | NSString *releaseName = [NSString stringWithFormat:@"%@ - %@", 34 | [asset displayName], 35 | [jvmType uppercaseString] 36 | ]; 37 | 38 | return releaseName; 39 | } 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTChecksum.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTChecksum.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import 20 | 21 | /*! 22 | @class MTChecksum 23 | @abstract This class provides a method to generate a sha256 checksum from a given file. 24 | The file is read in chunks to save memory. 25 | */ 26 | 27 | @interface MTChecksum : NSObject 28 | 29 | /*! 30 | @method sha256ChecksumWithPath: 31 | @abstract Generates the sha256 checksum for the file at the given path. 32 | @param path The path to the file the checksum should be generated for. 33 | @discussion Returns an initialized NSString object containing the checksum or an 34 | empty string if the file does not exist or is not readable. 35 | */ 36 | + (NSString*)sha256ChecksumWithPath:(NSString*)path; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTDefaultEnvironmentToolTipTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTDefaultEnvironmentToolTipTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTDefaultEnvironmentToolTipTransformer.h" 19 | #import "MTSapMachineAsset.h" 20 | 21 | @implementation MTDefaultEnvironmentToolTipTransformer 22 | 23 | + (BOOL)allowsReverseTransformation 24 | { 25 | return NO; 26 | } 27 | 28 | - (id)transformedValue:(id)value 29 | { 30 | MTSapMachineAsset *asset = (MTSapMachineAsset*)value; 31 | NSString *toolTipString = nil; 32 | 33 | if ([[asset javaHomeConfigFilePaths] objectForKey:@"system"]) { 34 | 35 | toolTipString = NSLocalizedString(@"javaHomeToolTipSystem", nil); 36 | 37 | } else { 38 | 39 | toolTipString = NSLocalizedString(@"javaHomeToolTipUser", nil); 40 | } 41 | 42 | return toolTipString; 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTOperationQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTOperationQueue.h 3 | Copyright 2022-2023 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTOperationQueue 22 | @abstract This is a sub class of NSOperationQueue that adds a method that allows to add a notification 23 | block that is called as soon as all operations have been finished. In contrast to the 24 | NSOperationQueue's addBarrierBlock: method, this method is also called if the queue became 25 | empty because all operations have been cancelled. 26 | */ 27 | 28 | @interface MTOperationQueue : NSOperationQueue 29 | 30 | /*! 31 | @method addNotificationBlock: 32 | @abstract Invokes a block when the queue finished all operations. 33 | @param block The block to execute. 34 | */ 35 | - (void)addNotificationBlock:(void (^) (void))block; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTLabelTextTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTLabelTextTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTLabelTextTransformer.h" 19 | 20 | @implementation MTLabelTextTransformer 21 | 22 | + (BOOL)allowsReverseTransformation 23 | { 24 | return NO; 25 | } 26 | 27 | - (id)transformedValue:(id)value 28 | { 29 | NSString *buttonText = @""; 30 | NSInteger updateCount = [value integerValue]; 31 | 32 | if (updateCount == 0) { 33 | 34 | buttonText = NSLocalizedString(@"noUpdatesAvailable", nil); 35 | 36 | } else if (updateCount == 1) { 37 | 38 | buttonText = NSLocalizedString(@"oneUpdateAvailable", nil); 39 | 40 | } else if (updateCount > 1) { 41 | 42 | buttonText = [NSString localizedStringWithFormat:NSLocalizedString(@"multipleUpdatesAvailable", nil), updateCount]; 43 | } 44 | 45 | return buttonText; 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "AppIcon-16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "AppIcon-32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "AppIcon-32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "AppIcon-64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "AppIcon-128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "AppIcon-256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "AppIcon-256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "AppIcon-512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "AppIcon-512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "AppIcon-1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /source/SapMachine Manager/AppIcon.icon/Assets/l2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /source/SapMachineXPC/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | main.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "SapMachineXPC.h" 20 | 21 | @interface ServiceDelegate : NSObject 22 | @end 23 | 24 | @implementation ServiceDelegate 25 | 26 | - (BOOL)listener:(NSXPCListener *)listener shouldAcceptNewConnection:(NSXPCConnection *)newConnection 27 | { 28 | [newConnection setExportedInterface:[NSXPCInterface interfaceWithProtocol:@protocol(SapMachineXPCProtocol)]]; 29 | [newConnection setExportedObject:[[SapMachineXPC alloc] init]]; 30 | [newConnection resume]; 31 | 32 | return YES; 33 | } 34 | 35 | @end 36 | 37 | int main(int argc, const char *argv[]) 38 | { 39 | #pragma unused(argc) 40 | #pragma unused(argv) 41 | 42 | ServiceDelegate *delegate = [[ServiceDelegate alloc] init]; 43 | 44 | // set up the NSXPCListener 45 | NSXPCListener *listener = [NSXPCListener serviceListener]; 46 | [listener setDelegate:delegate]; 47 | [listener resume]; 48 | 49 | return EXIT_SUCCESS; 50 | } 51 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTToolbarItem.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTToolbarItem.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTToolbarItem.h" 19 | 20 | @implementation MTToolbarItem 21 | 22 | - (void)validate 23 | { 24 | BOOL enabled = YES; 25 | 26 | // get the content controller… 27 | NSSplitViewController *consoleSplitViewController = (NSSplitViewController*)[[[self view] window] contentViewController]; 28 | 29 | if (consoleSplitViewController && [consoleSplitViewController respondsToSelector:@selector(validateToolbarItem:)]) { 30 | 31 | NSInvocationOperation *invocation = [[NSInvocationOperation alloc] initWithTarget:consoleSplitViewController 32 | selector:@selector(validateToolbarItem:) 33 | object:self 34 | ]; 35 | [invocation start]; 36 | [[invocation result] getValue:&enabled]; 37 | 38 | [self setEnabled:enabled]; 39 | } 40 | } 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTDefaultEnvironmentImageTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTDefaultEnvironmentImageTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTDefaultEnvironmentImageTransformer.h" 19 | #import "MTSapMachineAsset.h" 20 | 21 | @implementation MTDefaultEnvironmentImageTransformer 22 | 23 | + (BOOL)allowsReverseTransformation 24 | { 25 | return NO; 26 | } 27 | 28 | - (id)transformedValue:(id)value 29 | { 30 | MTSapMachineAsset *asset = (MTSapMachineAsset*)value; 31 | NSString *imageName = nil; 32 | 33 | if ([[asset javaHomeConfigFilePaths] objectForKey:@"system"]) { 34 | 35 | imageName = @"house.fill"; 36 | 37 | } else { 38 | 39 | imageName = @"house"; 40 | } 41 | 42 | NSImage *statusImage = [NSImage imageWithSystemSymbolName:imageName accessibilityDescription:imageName]; 43 | NSImageSymbolConfiguration *config = [NSImageSymbolConfiguration configurationWithScale:NSImageSymbolScaleLarge]; 44 | statusImage = [statusImage imageWithSymbolConfiguration:config]; 45 | 46 | return statusImage; 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /source/SapMachine Manager/InfoPlist.xcstrings: -------------------------------------------------------------------------------- 1 | { 2 | "sourceLanguage" : "en", 3 | "strings" : { 4 | "CFBundleDisplayName" : { 5 | "comment" : "the localized app name", 6 | "extractionState" : "manual", 7 | "localizations" : { 8 | "de" : { 9 | "stringUnit" : { 10 | "state" : "translated", 11 | "value" : "SapMachine Manager" 12 | } 13 | }, 14 | "en" : { 15 | "stringUnit" : { 16 | "state" : "translated", 17 | "value" : "SapMachine Manager" 18 | } 19 | } 20 | } 21 | }, 22 | "CFBundleName" : { 23 | "comment" : "Bundle name", 24 | "extractionState" : "extracted_with_value", 25 | "localizations" : { 26 | "de" : { 27 | "stringUnit" : { 28 | "state" : "translated", 29 | "value" : "SapMachine Manager" 30 | } 31 | }, 32 | "en" : { 33 | "stringUnit" : { 34 | "state" : "new", 35 | "value" : "SapMachine Manager" 36 | } 37 | } 38 | } 39 | }, 40 | "NSHumanReadableCopyright" : { 41 | "comment" : "the copyright string (for the application's info window in Finder)", 42 | "extractionState" : "extracted_with_value", 43 | "localizations" : { 44 | "de" : { 45 | "stringUnit" : { 46 | "state" : "needs_review", 47 | "value" : "Copyright © 2023-2024 SAP SE. Alle Rechte vorbehalten." 48 | } 49 | }, 50 | "en" : { 51 | "stringUnit" : { 52 | "state" : "new", 53 | "value" : "Copyright © 2023-2025 SAP SE. All rights reserved." 54 | } 55 | } 56 | } 57 | } 58 | }, 59 | "version" : "1.0" 60 | } -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTStoryboardAnimator.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTStoryboardAnimator.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTStoryboardAnimator.h" 19 | 20 | @implementation MTStoryboardAnimator 21 | 22 | - (void)animatePresentationOfViewController:(NSViewController*)viewController fromViewController:(NSViewController*)fromViewController { 23 | 24 | NSWindow *window = [[fromViewController view] window]; 25 | 26 | if (window) { 27 | 28 | [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { 29 | [window setContentViewController:viewController]; 30 | 31 | } completionHandler:nil]; 32 | } 33 | } 34 | 35 | - (void)animateDismissalOfViewController:(NSViewController*)viewController fromViewController:(NSViewController*)fromViewController { 36 | 37 | NSWindow *window = [[viewController view] window]; 38 | 39 | if (window) { 40 | 41 | [NSAnimationContext runAnimationGroup:^(NSAnimationContext *context) { 42 | [window setContentViewController:fromViewController]; 43 | 44 | } completionHandler:nil]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTLogDetailsController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTLogDetailsController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTLogDetailsController.h" 19 | #import "Constants.h" 20 | 21 | @interface MTLogDetailsController () 22 | @property (weak) IBOutlet NSTextView *logDetailsView; 23 | @end 24 | 25 | @implementation MTLogDetailsController 26 | 27 | - (void)viewDidLoad 28 | { 29 | [super viewDidLoad]; 30 | 31 | [_logDetailsView setFont:[NSFont monospacedSystemFontOfSize:11 weight:NSFontWeightRegular]]; 32 | 33 | // register for notifications 34 | [[NSNotificationCenter defaultCenter] addObserver:self 35 | selector:@selector(updateDetailView:) 36 | name:kMTNotificationNameLogMessage 37 | object:nil 38 | ]; 39 | } 40 | 41 | - (void)updateDetailView:(NSNotification*)notification 42 | { 43 | NSDictionary *userInfo = [notification userInfo]; 44 | 45 | if (userInfo) { 46 | 47 | NSString *logMessage = [userInfo objectForKey:kMTNotificationKeyLogMessage]; 48 | if (logMessage) { [self.logDetailsView setString:logMessage]; } 49 | } 50 | } 51 | 52 | @end 53 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseImageTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseImageTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTReleaseImageTransformer.h" 19 | #import "MTSapMachineAsset.h" 20 | 21 | @implementation MTReleaseImageTransformer 22 | 23 | + (BOOL)allowsReverseTransformation 24 | { 25 | return NO; 26 | } 27 | 28 | - (id)transformedValue:(id)value 29 | { 30 | MTSapMachineAsset *asset = (MTSapMachineAsset*)value; 31 | NSString *imageName = nil; 32 | 33 | if ([asset downloadURLs]) { 34 | 35 | if ([[asset currentVersion] compare:[asset installedVersion]] == NSOrderedDescending) { 36 | 37 | imageName = @"exclamationmark.triangle"; 38 | 39 | } else { 40 | 41 | imageName = @"checkmark.circle"; 42 | } 43 | 44 | } else { 45 | 46 | imageName = @"questionmark.square"; 47 | } 48 | 49 | NSImage *statusImage = [NSImage imageWithSystemSymbolName:imageName accessibilityDescription:imageName]; 50 | NSImageSymbolConfiguration *config = [NSImageSymbolConfiguration configurationWithScale:NSImageSymbolScaleLarge]; 51 | statusImage = [statusImage imageWithSymbolConfiguration:config]; 52 | 53 | return statusImage; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /REUSE.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | SPDX-PackageName = "sapmachine-manager-for-macos" 3 | SPDX-PackageSupplier = "ospo@sap.com" 4 | SPDX-PackageDownloadLocation = "https://github.com/SAP/sapmachine-manager-for-macos" 5 | SPDX-PackageComment = "The code in this project may include calls to APIs (\"API Calls\") of\n SAP or third-party products or services developed outside of this project\n (\"External Products\").\n \"APIs\" means application programming interfaces, as well as their respective\n specifications and implementing code that allows software to communicate with\n other software.\n API Calls to External Products are not licensed under the open source license\n that governs this project. The use of such API Calls and related External\n Products are subject to applicable additional agreements with the relevant\n provider of the External Products. In no event shall the open source license\n that governs this project grant any rights in or to any External Products,or\n alter, expand or supersede any terms of the applicable additional agreements.\n If you have a valid license agreement with SAP for the use of a particular SAP\n External Product, then you may make use of any API Calls included in this\n project's code for that SAP External Product, subject to the terms of such\n license agreement. If you do not have a valid license agreement for the use of\n a particular SAP External Product, then you may only make use of any API Calls\n in this project for that SAP External Product for your internal, non-productive\n and non-commercial test and evaluation of such API Calls. Nothing herein grants\n you any rights to use or access any SAP External Product, or provide any third\n parties the right to use of access any SAP External Product, through API Calls." 6 | 7 | [[annotations]] 8 | path = "**" 9 | precedence = "aggregate" 10 | SPDX-FileCopyrightText = "2024-2025 SAP SE or an SAP affiliate company and sapmachine-manager-for-macos contributors" 11 | SPDX-License-Identifier = "Apache-2.0" 12 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseStatusTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseStatusTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTReleaseStatusTransformer.h" 19 | #import "MTSapMachineAsset.h" 20 | 21 | @implementation MTReleaseStatusTransformer 22 | 23 | + (BOOL)allowsReverseTransformation 24 | { 25 | return NO; 26 | } 27 | 28 | - (id)transformedValue:(id)value 29 | { 30 | MTSapMachineAsset *asset = (MTSapMachineAsset*)value; 31 | MTSapMachineVersion *installedVersion = [asset installedVersion]; 32 | MTSapMachineVersion *currentVersion = [asset currentVersion]; 33 | 34 | NSString *statusString = nil; 35 | 36 | if ([asset downloadURLs]) { 37 | 38 | if ([currentVersion compare:installedVersion] == NSOrderedDescending) { 39 | 40 | statusString = [NSString localizedStringWithFormat:NSLocalizedString(@"statusUpdateAvailable", nil), [installedVersion versionString], [currentVersion versionString]]; 41 | 42 | } else { 43 | 44 | statusString = [NSString localizedStringWithFormat:NSLocalizedString(@"statusUpToDate", nil), [installedVersion versionString]]; 45 | } 46 | 47 | } else { 48 | 49 | statusString = NSLocalizedString(@"statusUnsupported", nil); 50 | } 51 | 52 | return statusString; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /source/SapMachine Manager/AppIcon.icon/icon.json: -------------------------------------------------------------------------------- 1 | { 2 | "fill" : { 3 | "linear-gradient" : [ 4 | "display-p3:0.85127,0.92523,0.94532,1.00000", 5 | "display-p3:0.58152,0.86647,0.93703,1.00000" 6 | ] 7 | }, 8 | "groups" : [ 9 | { 10 | "layers" : [ 11 | { 12 | "blend-mode" : "normal", 13 | "fill-specializations" : [ 14 | { 15 | "appearance" : "tinted", 16 | "value" : { 17 | "solid" : "extended-gray:0.50000,1.00000" 18 | } 19 | } 20 | ], 21 | "glass" : false, 22 | "hidden" : false, 23 | "image-name" : "l2.svg", 24 | "name" : "l2", 25 | "position" : { 26 | "scale" : 1, 27 | "translation-in-points" : [ 28 | 252.515625, 29 | 313.171875 30 | ] 31 | } 32 | }, 33 | { 34 | "fill-specializations" : [ 35 | { 36 | "value" : "none" 37 | }, 38 | { 39 | "appearance" : "tinted", 40 | "value" : "none" 41 | } 42 | ], 43 | "glass-specializations" : [ 44 | { 45 | "value" : false 46 | }, 47 | { 48 | "appearance" : "light", 49 | "value" : false 50 | } 51 | ], 52 | "image-name" : "l1.svg", 53 | "name" : "l1", 54 | "position" : { 55 | "scale" : 1.15, 56 | "translation-in-points" : [ 57 | -42.3359375, 58 | -56.2265625 59 | ] 60 | } 61 | } 62 | ], 63 | "shadow" : { 64 | "kind" : "neutral", 65 | "opacity" : 0.5 66 | }, 67 | "translucency" : { 68 | "enabled" : true, 69 | "value" : 0.5 70 | } 71 | } 72 | ], 73 | "supported-platforms" : { 74 | "squares" : [ 75 | "macOS" 76 | ] 77 | } 78 | } -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTReleaseStatusToolTipTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTReleaseStatusToolTipTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTReleaseStatusToolTipTransformer.h" 19 | #import "MTSapMachineAsset.h" 20 | 21 | @implementation MTReleaseStatusToolTipTransformer 22 | 23 | + (BOOL)allowsReverseTransformation 24 | { 25 | return NO; 26 | } 27 | 28 | - (id)transformedValue:(id)value 29 | { 30 | MTSapMachineAsset *asset = (MTSapMachineAsset*)value; 31 | MTSapMachineVersion *installedVersion = [asset installedVersion]; 32 | MTSapMachineVersion *currentVersion = [asset currentVersion]; 33 | 34 | NSString *statusString = nil; 35 | 36 | if ([asset downloadURLs]) { 37 | 38 | if ([currentVersion compare:installedVersion] == NSOrderedDescending) { 39 | 40 | statusString = [NSString localizedStringWithFormat:NSLocalizedString(@"statusToolTipUpdateAvailable", nil), [installedVersion versionString], [currentVersion versionString]]; 41 | 42 | } else { 43 | 44 | statusString = [NSString localizedStringWithFormat:NSLocalizedString(@"statusToolTipUpToDate", nil), [installedVersion versionString]]; 45 | } 46 | 47 | } else { 48 | 49 | statusString = NSLocalizedString(@"statusToolTipUnsupported", nil); 50 | } 51 | 52 | return statusString; 53 | } 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /source/SapMachine Manager/postinstall.txt: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # postinstall 4 | # Copyright 2023-2025 SAP SE 5 | 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | 19 | # initialize some variables 20 | sapMachineReleases=( 21 | "arm64;;{{installerAppleSilicon}}", 22 | "x86_64;;{{installerIntelProcessor}}" 23 | ) 24 | currentArchitecture=$(/usr/bin/uname -m) 25 | exitCode=0 26 | 27 | # This is our logging function. It logs to syslog and also prints the 28 | # log message to STDOUT to make sure, it appears in Jamf Pro policy logs. 29 | log() 30 | { 31 | local errorMsg="$1" 32 | echo "$errorMsg" 33 | /usr/bin/logger "SAPCorp: $errorMsg" 34 | } 35 | 36 | if [[ "$currentArchitecture" = "arm64" || "$currentArchitecture" = "x86_64" ]]; then 37 | 38 | installArchive=$(/usr/bin/sed -n "s/.*${currentArchitecture};;\([^, ]*\).*/\1/p" <<< " ${sapMachineReleases[@]} ") 39 | 40 | if [[ -n "$installArchive" ]]; then 41 | 42 | if [[ -f "$installArchive" ]]; then 43 | /usr/bin/tar -xzf "$installArchive" -U -C "{{targetFolder}}" --uname root --gname wheel --no-xattrs 44 | exitCode=$? 45 | else 46 | log "ERROR! File \"$installArchive\" for architecture \"$currentArchitecture\" not found" 47 | exitCode=3 48 | fi 49 | 50 | else 51 | log "ERROR! File for architecture \"$currentArchitecture\" does not exist" 52 | exitCode=2 53 | fi 54 | 55 | else 56 | log "ERROR! Unsupported architecture \"$currentArchitecture\"" 57 | exitCode=1 58 | fi 59 | 60 | exit $exitCode 61 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTChecksum.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTChecksum.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTChecksum.h" 19 | 20 | @implementation MTChecksum 21 | 22 | + (NSString*)sha256ChecksumWithPath:(NSString*)path 23 | { 24 | NSMutableString *checksumString = [[NSMutableString alloc] init]; 25 | 26 | NSFileHandle *handle = [NSFileHandle fileHandleForReadingAtPath:path]; 27 | 28 | if (handle) { 29 | 30 | BOOL done = NO; 31 | 32 | CC_SHA256_CTX sha; 33 | CC_SHA256_Init(&sha); 34 | 35 | while (!done) { 36 | 37 | NSError *error = nil; 38 | NSData *fileData = [handle readDataUpToLength:4096 error:&error]; 39 | 40 | if (error) { 41 | 42 | break; 43 | 44 | } else { 45 | 46 | CC_SHA256_Update(&sha, [fileData bytes], (unsigned int)[fileData length]); 47 | if ([fileData length] == 0 ) { done = YES; } 48 | } 49 | } 50 | 51 | if (done) { 52 | 53 | unsigned char digest[CC_SHA256_DIGEST_LENGTH]; 54 | CC_SHA256_Final(digest, &sha); 55 | 56 | for (int i = 0; i < sizeof(digest); ++i) { 57 | [checksumString appendFormat:@"%02x", digest[i]]; 58 | } 59 | } 60 | } 61 | 62 | return checksumString; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Value Transformers/MTLogLevelValueTransformer.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTLogLevelValueTransformer.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTLogLevelValueTransformer.h" 19 | #import 20 | 21 | @implementation MTLogLevelValueTransformer 22 | 23 | + (BOOL)allowsReverseTransformation 24 | { 25 | return NO; 26 | } 27 | 28 | - (id)transformedValue:(id)value 29 | { 30 | NSImage *levelIndicator = nil; 31 | 32 | if (value && [value isKindOfClass:[OSLogEntryLog class]]) { 33 | 34 | OSLogEntryLog *entry = (OSLogEntryLog*)value; 35 | 36 | if ([entry level] == OSLogEntryLogLevelError) { 37 | 38 | NSImageSymbolConfiguration *config = [NSImageSymbolConfiguration configurationWithHierarchicalColor:[NSColor systemYellowColor]]; 39 | 40 | levelIndicator = [[NSImage imageWithSystemSymbolName:@"circlebadge.fill" accessibilityDescription:nil] imageWithSymbolConfiguration:config]; 41 | 42 | } else if ([entry level] == OSLogEntryLogLevelFault) { 43 | 44 | NSImageSymbolConfiguration *config = [NSImageSymbolConfiguration configurationWithHierarchicalColor:[NSColor systemRedColor]]; 45 | 46 | levelIndicator = [[NSImage imageWithSystemSymbolName:@"circlebadge.fill" accessibilityDescription:nil] imageWithSymbolConfiguration:config]; 47 | } 48 | } 49 | 50 | return levelIndicator; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTPackageIntroController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTPackageIntroController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTPackageIntroController.h" 19 | #import "MTPackageReleaseSelectController.h" 20 | #import "Constants.h" 21 | 22 | @interface MTPackageIntroController () 23 | @property (weak) IBOutlet NSTextField *infoTextField; 24 | 25 | @end 26 | 27 | @implementation MTPackageIntroController 28 | 29 | - (void)viewDidLoad 30 | { 31 | [super viewDidLoad]; 32 | 33 | // make the link in our text field clickable 34 | NSMutableAttributedString *finalString = [[NSMutableAttributedString alloc] initWithAttributedString:[_infoTextField attributedStringValue]]; 35 | 36 | NSDataDetector *linkDetector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil]; 37 | NSArray *allMatches = [linkDetector matchesInString:[finalString string] options:0 range:NSMakeRange(0, [[finalString string] length])]; 38 | 39 | for (NSTextCheckingResult *match in [allMatches reverseObjectEnumerator]) { 40 | [finalString addAttribute:NSLinkAttributeName value:[match URL] range:[match range]]; 41 | } 42 | 43 | [_infoTextField setAttributedStringValue:finalString]; 44 | } 45 | 46 | - (void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender 47 | { 48 | MTPackageReleaseSelectController *destController = [segue destinationController]; 49 | [destController setIsInstall:NO]; 50 | [destController setAssetCatalog:_assetCatalog]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTConsoleSplitViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTConsoleSplitViewController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTConsoleSplitViewController.h" 19 | 20 | @interface MTConsoleSplitViewController () 21 | 22 | @end 23 | 24 | @implementation MTConsoleSplitViewController 25 | 26 | - (void)viewDidLoad 27 | { 28 | [super viewDidLoad]; 29 | } 30 | 31 | - (BOOL)validateToolbarItem:(NSToolbarItem *)item 32 | { 33 | BOOL enable = NO; 34 | 35 | // get our content view's first view controller 36 | id contentViewController = [[self childViewControllers] firstObject]; 37 | 38 | // check if the view controller responds to the selector enableToolbarItem: 39 | // and if so, call the selector with our toolbar item and enable the toolbar 40 | // item depending on the result 41 | SEL selector = NSSelectorFromString(@"enableToolbarItem:"); 42 | if (contentViewController && [contentViewController respondsToSelector:selector]) { 43 | 44 | NSInvocationOperation *invocation = [[NSInvocationOperation alloc] initWithTarget:contentViewController 45 | selector:selector 46 | object:item 47 | ]; 48 | [invocation start]; 49 | [[invocation result] getValue:&enable]; 50 | 51 | [item setTarget:contentViewController]; 52 | } 53 | 54 | return enable; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachineDownload.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachineDownload.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "MTSapMachineAsset.h" 20 | 21 | /*! 22 | @class MTSapMachineDownload 23 | @abstract This class provides properties to associate a NSURLSessionDownloadTask 24 | object with a MTSapMachineAsset object. This makes it easy to access 25 | the corresponding MTSapMachineAsset object in the delegate methods of 26 | NSURLSessionDownloadTask. 27 | */ 28 | 29 | @interface MTSapMachineDownload : NSObject 30 | 31 | /*! 32 | @property asset 33 | @abstract A property to store the asset that should be downloaded. 34 | @discussion The value of this property is MTSapMachineAsset. 35 | */ 36 | @property (nonatomic, strong, readwrite) MTSapMachineAsset *asset; 37 | 38 | /*! 39 | @property task 40 | @abstract A property to store the download task that belongs to the asset. 41 | @discussion The value of this property is NSURLSessionDownloadTask. 42 | */ 43 | @property (nonatomic, strong, readwrite) NSURLSessionDownloadTask *task; 44 | 45 | /*! 46 | @property semaphore 47 | @abstract A property to store a semaphore for the download task. 48 | @discussion The value of this property is dispatch_semaphore_t. This property 49 | is used to keep the download task in our operations queue until 50 | the download task has been finished. 51 | */ 52 | @property (nonatomic, strong, readwrite) dispatch_semaphore_t semaphore; 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSystemInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSystemInfo.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTSystemInfo 22 | @abstract This class provides methods to get some system information. 23 | */ 24 | 25 | @interface MTSystemInfo : NSObject 26 | 27 | /*! 28 | @method processList 29 | @abstract Returns a list of all running processes. 30 | @discussion Returns an array containing the complete paths to all running processes 31 | or nil, if an error occurred. 32 | */ 33 | + (NSArray*)processList; 34 | 35 | /*! 36 | @method hardwareArchitecture 37 | @abstract Returns the current architecture. 38 | @discussion Returns @c x86_64 on Macs mit Intel processor and @c arm64 on Macs with 39 | Apple Silicon. If this method is used under Rosetta, it returns the actual architecture. 40 | */ 41 | + (NSString*)hardwareArchitecture; 42 | 43 | /*! 44 | @method processStartTime 45 | @abstract Returns the time the current process has been started. 46 | */ 47 | + (NSDate*)processStartTime; 48 | 49 | /*! 50 | @method isAdminUser:error: 51 | @abstract Returns if the given user is an admin user or not. 52 | @param userName The name of the user. 53 | @param error A reference to an NSError object to store error information. 54 | @discussion Returns YES if the user is an admin user, otherwise returns NO. If an error occurred 55 | the NSError object might provide information about the error that caused the operation to fail. 56 | */ 57 | + (BOOL)isAdminUser:(NSString*)userName error:(NSError**)error; 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachineUser.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachineUser.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTSapMachineUser.h" 19 | #import "MTSystemInfo.h" 20 | #import "Constants.h" 21 | #import 22 | 23 | @interface MTSapMachineUser () 24 | @property (nonatomic, strong, readwrite) NSString *userName; 25 | @end 26 | 27 | @implementation MTSapMachineUser 28 | 29 | - (instancetype)initWithUserName:(NSString*)userName 30 | { 31 | self = [super init]; 32 | 33 | if (self) { 34 | _userName = userName; 35 | } 36 | 37 | return self; 38 | } 39 | 40 | - (instancetype)initWithUserID:(uid_t)userID 41 | { 42 | struct passwd *p = getpwuid(userID); 43 | NSString *userName = [NSString stringWithUTF8String:p->pw_name]; 44 | 45 | if (userName) { 46 | 47 | self = [self initWithUserName:userName]; 48 | 49 | } else { 50 | 51 | self = nil; 52 | } 53 | 54 | return self; 55 | } 56 | 57 | - (BOOL)isPrivileged 58 | { 59 | BOOL privilegedUser = NO; 60 | 61 | NSUserDefaults *userDefaults = nil; 62 | NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; 63 | 64 | if (bundleIdentifier && [bundleIdentifier isEqualToString:kMTAppBundleIdentifier]) { 65 | 66 | userDefaults = [NSUserDefaults standardUserDefaults]; 67 | 68 | } else { 69 | 70 | userDefaults = [[NSUserDefaults alloc] initWithSuiteName:kMTAppBundleIdentifier]; 71 | } 72 | 73 | if ([userDefaults objectIsForcedForKey:kMTDefaultsDontRequireAdminKey] && 74 | [userDefaults boolForKey:kMTDefaultsDontRequireAdminKey]) { 75 | 76 | privilegedUser = YES; 77 | 78 | } else { 79 | 80 | privilegedUser = [MTSystemInfo isAdminUser:_userName error:nil]; 81 | } 82 | 83 | return privilegedUser; 84 | } 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachineUser.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachineUser.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTSapMachineUser 22 | @abstract This class provides a method to determine if a user is allowed 23 | to run privileged tasks within SapMachine manager. 24 | */ 25 | 26 | @interface MTSapMachineUser : NSObject 27 | 28 | /*! 29 | @method init 30 | @discussion The init method is not available. Please use initWithUserName: or 31 | initWithUserID: instead. 32 | */ 33 | - (instancetype)init NS_UNAVAILABLE; 34 | 35 | /*! 36 | @method initWithUserName: 37 | @abstract Initialize a MTSapMachineUser object with a given user name. 38 | @param userName The name of the user. 39 | */ 40 | - (instancetype)initWithUserName:(NSString*)userName NS_DESIGNATED_INITIALIZER; 41 | 42 | /*! 43 | @method initWithUserID: 44 | @abstract Initialize a MTSapMachineUser object with a given user id. 45 | @param userID The numeric user id of the user. 46 | */ 47 | - (instancetype)initWithUserID:(uid_t)userID; 48 | 49 | /*! 50 | @property userName 51 | @abstract A read-only property that returns the user name of the receiver. 52 | @discussion The value of this property is string. 53 | */ 54 | @property (nonatomic, strong, readonly) NSString *userName; 55 | 56 | /*! 57 | @method isPrivileged 58 | @abstract Determine if the user is allowed to run privileged tasks. 59 | @discussion Returns YES if the user is either and admin user or the user is a 60 | standard user but provided admin credentials or if the user is a 61 | standard user and standard users are allowed to run privileged 62 | tasks (via configuration profile). Otherwise returns NO. 63 | */ 64 | - (BOOL)isPrivileged; 65 | 66 | @end 67 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTPackageArchSelectController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTPackageArchSelectController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTPackageArchSelectController.h" 19 | #import "MTPackageBuildController.h" 20 | #import "Constants.h" 21 | 22 | @interface MTPackageArchSelectController () 23 | @property (assign) NSInteger selectedArchitecture; 24 | 25 | @property (weak) IBOutlet NSButton *archAppleButton; 26 | @property (weak) IBOutlet NSButton *archIntelButton; 27 | @property (weak) IBOutlet NSButton *archBothButton; 28 | @end 29 | 30 | @implementation MTPackageArchSelectController 31 | 32 | - (void)viewDidLoad 33 | { 34 | [super viewDidLoad]; 35 | 36 | if ([[_selectedAsset downloadURLs] objectForKey:kMTSapMachineArchApple] && [[_selectedAsset downloadURLs] objectForKey:kMTSapMachineArchIntel]) { 37 | 38 | [_archBothButton setState:NSControlStateValueOn]; 39 | self.selectedArchitecture = 3; 40 | 41 | } else if ([[_selectedAsset downloadURLs] objectForKey:kMTSapMachineArchApple]) { 42 | 43 | [_archAppleButton setState:NSControlStateValueOn]; 44 | self.selectedArchitecture = 1; 45 | 46 | } else if ([[_selectedAsset downloadURLs] objectForKey:kMTSapMachineArchIntel]) { 47 | 48 | [_archIntelButton setState:NSControlStateValueOn]; 49 | self.selectedArchitecture = 2; 50 | 51 | } else { 52 | 53 | self.selectedArchitecture = 0; 54 | } 55 | } 56 | 57 | - (IBAction)selectArchitecture:(id)sender 58 | { 59 | self.selectedArchitecture = [sender tag]; 60 | } 61 | 62 | - (void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender 63 | { 64 | if ([[segue identifier] isEqualToString:@"corp.sap.SapMachineManager.pkgBuilder.build"]) { 65 | 66 | MTPackageBuildController *destController = [segue destinationController]; 67 | [destController setSelectedAsset:_selectedAsset]; 68 | [destController setSelectedArchitecture:_selectedArchitecture]; 69 | } 70 | } 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTSettingsTabViewController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTSettingsTabViewController.m 3 | Copyright 2022-2023 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTSettingsTabViewController.h" 19 | #import "Constants.h" 20 | 21 | @interface MTSettingsTabViewController () 22 | @property (assign) BOOL skipSelection; 23 | @end 24 | 25 | @implementation MTSettingsTabViewController 26 | 27 | - (id)initWithCoder:(NSCoder *)coder 28 | { 29 | self = [super initWithCoder:coder]; 30 | 31 | if (self) { 32 | 33 | _skipSelection = YES; 34 | } 35 | 36 | return self; 37 | } 38 | 39 | - (void)viewDidLoad 40 | { 41 | [super viewDidLoad]; 42 | 43 | // select the last tab the user selected 44 | NSInteger selectedTabIndex = [[NSUserDefaults standardUserDefaults] integerForKey:kMTDefaultsSettingsSelectedTabKey]; 45 | 46 | if (selectedTabIndex >= 0 && selectedTabIndex < [[self tabViewItems] count]) { 47 | [self setSelectedTabViewItemIndex:selectedTabIndex]; 48 | } else { 49 | [self setSelectedTabViewItemIndex:0]; 50 | } 51 | } 52 | 53 | - (void)viewWillAppear 54 | { 55 | [super viewWillAppear]; 56 | [self updateWindowTitle]; 57 | } 58 | 59 | - (void)tabView:(NSTabView *)tabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem 60 | { 61 | [super tabView:tabView didSelectTabViewItem:tabViewItem]; 62 | [self updateWindowTitle]; 63 | 64 | // we skip the initial tab selection (the one we had to define in Xcode) 65 | if (_skipSelection) { 66 | 67 | _skipSelection = NO; 68 | 69 | } else { 70 | 71 | [[NSUserDefaults standardUserDefaults] setInteger:[tabView indexOfTabViewItem:[tabView selectedTabViewItem]] forKey:kMTDefaultsSettingsSelectedTabKey]; 72 | } 73 | } 74 | 75 | - (void)updateWindowTitle 76 | { 77 | // set the window title to the label of the selected tab 78 | NSTabViewItem *selectedItem = [[self tabView] selectedTabViewItem]; 79 | [[[self tabView] window] setTitle:[selectedItem label]]; 80 | } 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /source/SapMachineXPC/SapMachineXPCProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | SapMachineXPCProtocol.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @protocol SapMachineXPCProtocol 22 | @abstract Defines the protocol implemented by the xpc service and 23 | called by SapMachine Manager. 24 | */ 25 | 26 | @protocol SapMachineXPCProtocol 27 | 28 | /*! 29 | @method connectWithDaemonEndpointReply: 30 | @abstract Returns an endpoint that's connected to the daemon. 31 | @param reply The reply block to call when the request is complete. 32 | */ 33 | - (void)connectWithDaemonEndpointReply:(void(^)(NSXPCListenerEndpoint *endpoint))reply; 34 | 35 | /*! 36 | @method releaseFileFromQuarantineAtURL:recursive:completionHandler: 37 | @abstract Releases the file at the given url from quarantine. 38 | @param url An url that points to a file or folder. 39 | @param recursive If set to NO, only the file or folder at the given url will be 40 | released from quarantive. If set to YES and the given url points to a folder, 41 | the folder and all items in the folder are recursively removed from quarantine . 42 | @param completionHandler The handler to call when the request is complete. 43 | @discussion Returns nil if the operation succeeded. In case of an error the error object might 44 | contain information about the error that caused the operation to fail. 45 | */ 46 | - (void)releaseFileFromQuarantineAtURL:(NSURL*)url recursive:(BOOL)recursive completionHandler:(void(^)(NSError *error))completionHandler; 47 | 48 | /*! 49 | @method authenticateWithAuthorizationReply:: 50 | @abstract Authenticates the user. 51 | @param reply The reply block to call when the request is complete. 52 | @discussion Returns the xpc service's authorization reference so the app can pass that to the 53 | requests it sends to the daemon. 54 | */ 55 | - (void)authenticateWithAuthorizationReply:(void (^)(NSData *authorization))reply; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/xcshareddata/xcschemes/SMUDaemon.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 44 | 46 | 52 | 53 | 54 | 55 | 61 | 62 | 64 | 65 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | ## Code of Conduct 4 | 5 | All members of the project community must abide by the [SAP Open Source Code of Conduct](https://github.com/SAP/.github/blob/main/CODE_OF_CONDUCT.md). 6 | Only by respecting each other we can develop a productive, collaborative community. 7 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting [a project maintainer](.reuse/dep5). 8 | 9 | ## Engaging in Our Project 10 | 11 | We use GitHub to manage reviews of pull requests. 12 | 13 | * If you are a new contributor, see: [Steps to Contribute](#steps-to-contribute) 14 | 15 | * Before implementing your change, create an issue that describes the problem you would like to solve or the code that should be enhanced. Please note that you are willing to work on that issue. 16 | 17 | * The team will review the issue and decide whether it should be implemented as a pull request. In that case, they will assign the issue to you. If the team decides against picking up the issue, the team will post a comment with an explanation. 18 | 19 | ## Steps to Contribute 20 | 21 | Should you wish to work on an issue, please claim it first by commenting on the GitHub issue that you want to work on. This is to prevent duplicated efforts from other contributors on the same issue. 22 | 23 | If you have questions about one of the issues, please comment on them, and one of the maintainers will clarify. 24 | 25 | ## Contributing Code or Documentation 26 | 27 | You are welcome to contribute code in order to fix a bug or to implement a new feature that is logged as an issue. 28 | 29 | The following rule governs code contributions: 30 | 31 | * Contributions must be licensed under the [Apache 2.0 License](./LICENSE) 32 | * Due to legal reasons, contributors will be asked to accept a Developer Certificate of Origin (DCO) when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/). 33 | 34 | ## Contributing with AI-generated code 35 | As artificial intelligence evolves, AI-generated code is becoming valuable for many software projects, including open-source initiatives. While we recognize the potential benefits of incorporating AI-generated content into our open-source projects there are certain requirements that need to be reflected and adhered to when making contributions. 36 | 37 | Please see our [guideline for AI-generated code contributions to SAP Open Source Software Projects](https://github.com/SAP/.github/blob/main/CONTRIBUTING_USING_GENAI.md) for these requirements. 38 | 39 | ## Issues and Planning 40 | 41 | * We use GitHub issues to track bugs and enhancement requests. 42 | 43 | * Please provide as much context as possible when you open an issue. The information you provide must be comprehensive enough to reproduce that issue for the assignee. 44 | -------------------------------------------------------------------------------- /source/SMUDaemon/MTCodeSigning.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTCodeSigning.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTCodeSigning 22 | @abstract A class that provides some methods related to code signing and sandboxing. 23 | */ 24 | 25 | @interface MTCodeSigning : NSObject 26 | 27 | /*! 28 | @method getSigningAuthorityWithError: 29 | @abstract Returns the current app's signing authority. 30 | @param error A reference to a NSError object that indicates why the xpc connection failed. 31 | @discussion Returns the current app's signing authority or nil if an error occurred. In case of an error 32 | the error object might contain information about the error that caused the operation 33 | to fail. 34 | */ 35 | + (NSString*)getSigningAuthorityWithError:(NSError**)error; 36 | 37 | /*! 38 | @method codeSigningRequirementsWithCommonName:bundleIdentifier:versionString: 39 | @abstract Returns the code signing requirements constructed from the given parameters. 40 | @param commonName The common name (signing authority) that should be used for the code signing requirements. 41 | @param bundleIdentifier The app's bundle identifier that should be used for the code signing requirements. 42 | @param versionString The app's version string (e.g. 2.0.0) that should be used for the code signing requirements. 43 | @discussion Returns a string containing the code signing requirements or nil if an error occurred. 44 | */ 45 | + (NSString*)codeSigningRequirementsWithCommonName:(NSString*)commonName 46 | bundleIdentifier:(NSString*)bundleIdentifier 47 | versionString:(NSString*)versionString; 48 | 49 | /*! 50 | @method sandboxStatusWithCompletionHandler: 51 | @abstract Returns whether the current application is sandboxed or not. 52 | @param completionHandler The completion handler to call when the request is complete. 53 | @discussion Returns YES if the current application is sandboxed, otherwise returns NO. In case of an error 54 | the error object might contain information about the error that caused the operation 55 | to fail. 56 | */ 57 | + (void)sandboxStatusWithCompletionHandler:(void (^)(BOOL isSandboxed, NSError *error))completionHandler; 58 | 59 | @end 60 | 61 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTSettingsGeneralController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTSettingsGeneralController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTSettingsGeneralController.h" 19 | #import "MTDaemonConnection.h" 20 | 21 | @interface MTSettingsGeneralController () 22 | @property (nonatomic, strong, readwrite) MTDaemonConnection *daemonConnection; 23 | 24 | @property (weak) IBOutlet NSButton *autoUpdateCheckbox; 25 | @end 26 | 27 | @implementation MTSettingsGeneralController 28 | 29 | - (void)viewDidLoad 30 | { 31 | [super viewDidLoad]; 32 | 33 | [_autoUpdateCheckbox setState:NSControlStateValueOff]; 34 | [_autoUpdateCheckbox setEnabled:NO]; 35 | 36 | _daemonConnection = [[MTDaemonConnection alloc] init]; 37 | 38 | [_daemonConnection connectToDaemonWithExportedObject:nil 39 | andExecuteCommandBlock:^{ 40 | 41 | [[[self->_daemonConnection connection] remoteObjectProxyWithErrorHandler:^(NSError *error) { 42 | 43 | os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_FAULT, "SAPCorp: Failed to connect to daemon: %{public}@", error); 44 | 45 | }] automaticUpdatesEnabledWithReply:^(BOOL enabled, BOOL forced) { 46 | 47 | dispatch_async(dispatch_get_main_queue(), ^{ 48 | [self->_autoUpdateCheckbox setState:(enabled) ? NSControlStateValueOn : NSControlStateValueOff]; 49 | [self->_autoUpdateCheckbox setEnabled:!forced]; 50 | }); 51 | 52 | }]; 53 | }]; 54 | } 55 | 56 | - (IBAction)setAutoUpdate:(id)sender 57 | { 58 | [_daemonConnection connectToDaemonWithExportedObject:nil 59 | andExecuteCommandBlock:^{ 60 | 61 | NSControlStateValue checkboxState = [self->_autoUpdateCheckbox state]; 62 | 63 | [[self->_daemonConnection remoteObjectProxy] setAutomaticUpdatesEnabled:(checkboxState == NSControlStateValueOn) ? YES : NO completionHandler:^(BOOL success) { 64 | 65 | dispatch_async(dispatch_get_main_queue(), ^{ 66 | 67 | // revert the checkbox if the operation failed 68 | if (!success) { 69 | [self->_autoUpdateCheckbox setState:(checkboxState == NSControlStateValueOn) ? NSControlStateValueOff : NSControlStateValueOn]; 70 | } 71 | }); 72 | 73 | }]; 74 | }]; 75 | } 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /source/SMUDaemon/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | main.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "SMUDaemon.h" 20 | #import "SMUDaemonProtocol.h" 21 | #import "Constants.h" 22 | #import 23 | 24 | @interface Main : NSObject 25 | @property (nonatomic, strong, readwrite) SMUDaemon *smuDaemon; 26 | @end 27 | 28 | @implementation Main 29 | 30 | - (void)run 31 | { 32 | os_log(OS_LOG_DEFAULT, "SAPCorp: Starting"); 33 | 34 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 35 | 36 | [self->_smuDaemon automaticUpdatesEnabledWithReply:^(BOOL enabled, BOOL forced) { 37 | 38 | if (enabled && ![self->_smuDaemon operationInProgress]) { 39 | 40 | // we don't start automatic updates if the SapMachine Manager is running 41 | if ([self->_smuDaemon numberOfActiveXPCConnections] > 0) { 42 | 43 | os_log(OS_LOG_DEFAULT, "SAPCorp: Deferring automatic update checks while SapMachine Manager is running"); 44 | [self->_smuDaemon setShouldTerminate:YES]; 45 | 46 | } else { 47 | 48 | os_log(OS_LOG_DEFAULT, "SAPCorp: Checking for SapMachine updates"); 49 | [self->_smuDaemon setUpdateDelegate:nil]; 50 | [self->_smuDaemon updateAllAssetsWithCompletionHandler:^(BOOL success) { 51 | 52 | os_log(OS_LOG_DEFAULT, "SAPCorp: Update check complete"); 53 | [self->_smuDaemon setShouldTerminate:YES]; 54 | }]; 55 | } 56 | 57 | } else { 58 | 59 | [self->_smuDaemon setShouldTerminate:YES]; 60 | } 61 | }]; 62 | }); 63 | 64 | while (![_smuDaemon shouldTerminate] || [_smuDaemon operationInProgress] || [_smuDaemon numberOfActiveXPCConnections] > 0) { [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:60]]; } 65 | 66 | [_smuDaemon invalidateXPC]; 67 | os_log(OS_LOG_DEFAULT, "SAPCorp: Exiting"); 68 | } 69 | 70 | @end 71 | 72 | int main(int argc, const char * argv[]) 73 | { 74 | #pragma unused(argc) 75 | #pragma unused(argv) 76 | 77 | Main *m = [[Main alloc] init]; 78 | m.smuDaemon = [[SMUDaemon alloc] init]; 79 | 80 | [m run]; 81 | 82 | return EXIT_SUCCESS; 83 | } 84 | -------------------------------------------------------------------------------- /source/SapMachine Manager/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /* 2 | AppDelegate.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "AppDelegate.h" 19 | #import "Constants.h" 20 | 21 | @interface AppDelegate () 22 | @property (nonatomic, strong, readwrite) NSWindowController *settingsController; 23 | @end 24 | 25 | @implementation AppDelegate 26 | 27 | - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 28 | { 29 | // make sure we start with an empty temporary folder 30 | [self deleteTemporaryItems]; 31 | 32 | NSStoryboard *storyboard = [NSStoryboard storyboardWithName:@"Main" bundle:nil]; 33 | _settingsController = [storyboard instantiateControllerWithIdentifier:@"corp.sap.SapMachineManager.SettingsController"]; 34 | [_settingsController loadWindow]; 35 | } 36 | 37 | - (NSError*)deleteTemporaryItems 38 | { 39 | NSError *error = nil; 40 | NSArray *allItems = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:[NSURL fileURLWithPath:NSTemporaryDirectory()] 41 | includingPropertiesForKeys:nil 42 | options:NSDirectoryEnumerationSkipsHiddenFiles | NSDirectoryEnumerationSkipsSubdirectoryDescendants 43 | error:&error 44 | ]; 45 | 46 | for (NSURL *anItem in allItems) { 47 | 48 | [[NSFileManager defaultManager] removeItemAtURL:anItem 49 | error:&error]; 50 | } 51 | 52 | return error; 53 | } 54 | 55 | - (IBAction)openWebsite:(id)sender 56 | { 57 | NSString *urlString = ([sender tag] == 1000) ? kMTGitHubURL : kMTSapMachineWebsiteURL; 58 | [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:urlString]]; 59 | } 60 | 61 | - (IBAction)showSettingsWindow:(id)sender 62 | { 63 | [[_settingsController window] makeKeyAndOrderFront:nil]; 64 | } 65 | 66 | - (IBAction)showLogWindow:(id)sender 67 | { 68 | [[NSNotificationCenter defaultCenter] postNotificationName:kMTNotificationNameShowLog 69 | object:nil 70 | userInfo:nil 71 | ]; 72 | } 73 | 74 | - (void)applicationWillTerminate:(NSNotification *)aNotification 75 | { 76 | 77 | } 78 | 79 | - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app 80 | { 81 | return YES; 82 | } 83 | 84 | - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender 85 | { 86 | return YES; 87 | } 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /source/Shared/Constants.h: -------------------------------------------------------------------------------- 1 | /* 2 | Constants.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #define kMTJavaHomePath @"/usr/libexec/java_home" 19 | #define kMTUnarchiverPath @"/usr/bin/tar" 20 | #define kMTJVMFolderPath @"/Library/Java/JavaVirtualMachines" 21 | #define kMTSapMachineReleasesURL @"https://sapmachine.io/assets/data/sapmachine-releases-latest.json" 22 | #define kMTGitHubURL @"https://github.com/SAP/sapmachine-manager-for-macos" 23 | #define kMTSapMachineWebsiteURL @"https://sapmachine.io/" 24 | #define kMTErrorDomain @"corp.sap.SapMachineManager.ErrorDomain" 25 | #define kMTDaemonPlistName @"corp.sap.SMUDaemon.plist" 26 | #define kMTDaemonMachServiceName @"corp.sap.SapMachineManager.xpc" 27 | #define kMTAppBundleIdentifier @"corp.sap.SapMachineManager" 28 | #define kMTMaxConcurrentOperations 2 29 | #define kMTAdminGroupID 80 30 | 31 | #define kMTJVMTypeJRE @"jre" 32 | #define kMTJVMTypeJDK @"jdk" 33 | 34 | #define kMTSapMachineJDKIdentifier @"com.sap.openjdk.jdk" 35 | #define kMTSapMachineJREIdentifier @"com.sap.openjdk.jre" 36 | #define kMTSapMachineArchIntel @"macos-x64" 37 | #define kMTSapMachineArchApple @"macos-aarch64" 38 | 39 | // NSUserDefaults 40 | #define kMTDefaultsSettingsSelectedTabKey @"SettingsSelectedTab" 41 | #define kMTDefaultsInstallErrorKey @"InstallError" 42 | #define kMTDefaultsDontRequireAdminKey @"DontRequireAdminUser" 43 | #define kMTDefaultsLogDetailsEnabledKey @"LogDetailsEnabled" 44 | #define kMTDefaultsLogDividerPositionKey @"LogSplitViewDividerPosition" 45 | #define kMTDefaultsNoUpgradeAlertsKey @"SuppressUpgradeAlerts" 46 | #define kMTDefaultsNoUpgradeDeleteKey @"DontDeleteAfterUpgrade" 47 | 48 | // CFPreferences 49 | #define kMTDaemonPreferenceDomain CFSTR("corp.sap.SMUDaemon") 50 | #define kMTPrefsEnableAutoUpdateKey CFSTR("AutomaticUpdatesEnabled") 51 | #define kMTPrefsLastUpdateSuccessKey CFSTR("LastSuccessfulUpdate") 52 | #define kMTPrefsLastCheckSuccessKey CFSTR("LastSuccessfulCheck") 53 | 54 | // Notifications 55 | #define kMTNotificationKeyLogMessage @"LogMessage" 56 | #define kMTNotificationKeyInstallError @"InstallError" 57 | 58 | #define kMTNotificationNameLogMessage @"corp.sap.SapMachineManager.LogMessage" 59 | #define kMTNotificationNameShowLog @"corp.sap.SapMachineManager.ShowLog" 60 | #define kMTNotificationNameInstallFinished @"corp.sap.SapMachineManager.InstallFinished" 61 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachineVersion.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachineVersion.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import 20 | 21 | /*! 22 | @class MTSapMachineVersion 23 | @abstract This class provides a properties and methods to deal with SapMachine version numbers. 24 | */ 25 | 26 | @interface MTSapMachineVersion : NSObject 27 | 28 | /*! 29 | @property versionString 30 | @abstract A property that holds the version string. 31 | @discussion This property holds a cleanded version of the version string the object has 32 | been initialized with. The cleaned version contains only of numbers, dots and "+" 33 | signs. The value of this property is NSString. 34 | */ 35 | @property (nonatomic, strong, readonly) NSString *versionString; 36 | 37 | /*! 38 | @property normalizedVersionString 39 | @abstract A property that holds a normalized version of the version string. 40 | @discussion The normalized version string always consist of 6 digits separated by dots. 41 | The value of this property is NSString. 42 | */ 43 | @property (nonatomic, strong, readonly) NSString *normalizedVersionString; 44 | 45 | /*! 46 | @property majorVersion 47 | @abstract A property that holds the major version of the version string. 48 | @discussion The value of this property is NSUInteger. 49 | */ 50 | @property (assign, readonly) NSUInteger majorVersion; 51 | 52 | /*! 53 | @method initWithVersionString: 54 | @abstract Initialize a MTSapMachineVersion object with a given version string. 55 | @param versionString The version string of a SapMachine release. 56 | */ 57 | - (instancetype)initWithVersionString:(NSString*)versionString; 58 | 59 | /*! 60 | @method compare: 61 | @abstract Compares the MTSapMachineVersion object with the given MTSapMachineVersion object. 62 | @param version The MTSapMachineVersion object with which to compare the receiver. 63 | @discussion Returns an NSComparisonResult value that indicates the lexical ordering. Returns 64 | NSOrderedAscending if the receiver's normalizedVersionString precedes the given object's 65 | normalizedVersionString in lexical ordering, NSOrderedSame if the receiver's normalizedVersionString 66 | and given object's normalizedVersionString are equivalent in lexical value, and NSOrderedDescending 67 | if the receiver's normalizedVersionString follows the given object's normalizedVersionString. 68 | */ 69 | - (NSComparisonResult)compare:(MTSapMachineVersion*)version; 70 | 71 | /*! 72 | @method dictionaryRepresentation 73 | @abstract Returns a dictionary representation of the MTSapMachineVersion object. 74 | */ 75 | - (NSDictionary*)dictionaryRepresentation; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /source/SapMachine Manager.xcodeproj/xcshareddata/xcschemes/SapMachine Manager.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 30 | 31 | 32 | 33 | 34 | 40 | 41 | 51 | 53 | 59 | 60 | 61 | 62 | 68 | 69 | 75 | 76 | 77 | 78 | 80 | 81 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTDaemonConnection.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTDaemonConnection.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "SapMachineXPCProtocol.h" 20 | #import "SMUDaemonProtocol.h" 21 | #import 22 | #import 23 | 24 | /*! 25 | @protocol MTDaemonConnectionDelegate 26 | @abstract Defines an interface for delegates of MTDaemonConnection to be notified if 27 | the connection to the daemon failed. 28 | */ 29 | @protocol MTDaemonConnectionDelegate 30 | @optional 31 | 32 | /*! 33 | @method connection:didFailWithError: 34 | @abstract Called if the connection to the daemon failed. 35 | @param connection A reference to the NSXPCConnection instance that failed. 36 | @param error The error that caused the xpc connection to fail. 37 | @discussion Delegates receive this message if the connection to the daemon failed. 38 | */ 39 | - (void)connection:(NSXPCConnection*)connection didFailWithError:(NSError*)error; 40 | 41 | @end 42 | 43 | /*! 44 | @class MTDaemonConnection 45 | @abstract A class that provides an easy way to connect to a daemon (via xpc service). 46 | */ 47 | 48 | @interface MTDaemonConnection : NSObject 49 | 50 | /*! 51 | @property delegate 52 | @abstract The receiver's connection delegate. 53 | @discussion The value of this property is an object conforming to the MTDaemonConnectionDelegate protocol. 54 | */ 55 | @property (weak) id delegate; 56 | 57 | /*! 58 | @property connection 59 | @abstract A property to store the connection object. 60 | @discussion The value of this property is NSXPCConnection. 61 | */ 62 | @property (atomic, strong, readonly) NSXPCConnection *connection; 63 | 64 | /*! 65 | @property remoteObjectProxy 66 | @abstract A property to store the connection's remote object proxy. 67 | @discussion The value of this property is id. 68 | */ 69 | @property (atomic, strong, readonly) id remoteObjectProxy; 70 | 71 | /*! 72 | @method connectToXPCServiceWithRemoteObjectProxyReply: 73 | @abstract Returns a proxy for the xpc service. 74 | @param reply The reply block to call when the request is complete. 75 | @discussion Returns a proxy for the xpc service or nil if an error occurred. In case of an error 76 | the error object might contain information about the error that caused the operation 77 | to fail. 78 | */ 79 | - (void)connectToXPCServiceWithRemoteObjectProxyReply:(void (^)(id remoteObjectProxy, NSError *error))reply; 80 | 81 | /*! 82 | @method connectToDaemonWithExportedObject:andExecuteCommandBlock: 83 | @abstract Connects to the daemon and executes the given command block. 84 | @param exportedObject The object you want to export to the daemon. May be nil. 85 | @param commandBlock The command block that should be executed after the connection has been established. 86 | */ 87 | - (void)connectToDaemonWithExportedObject:(id)exportedObject 88 | andExecuteCommandBlock:(void(^)(void))commandBlock; 89 | 90 | /*! 91 | @method invalidate 92 | @abstract Invalidates the connection to the daemon (and xpc service). 93 | */ 94 | - (void)invalidate; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTInstallIntroController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTInstallIntroController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTInstallIntroController.h" 19 | #import "MTInstallController.h" 20 | #import "MTPackageReleaseSelectController.h" 21 | #import "Constants.h" 22 | 23 | @interface MTInstallIntroController () 24 | @property (nonatomic, strong, readwrite) MTSapMachineAsset *toBeInstalled; 25 | 26 | @property (weak) IBOutlet NSView *installRecommendedView; 27 | @property (weak) IBOutlet NSButton *installRecommended; 28 | @end 29 | 30 | @implementation MTInstallIntroController 31 | 32 | - (void)viewDidLoad 33 | { 34 | [super viewDidLoad]; 35 | 36 | [[NSUserDefaults standardUserDefaults] removeObjectForKey:kMTDefaultsInstallErrorKey]; 37 | 38 | // get the JDK of the latest LTS release for the current architecture… 39 | NSPredicate *predicate = [NSPredicate predicateWithFormat:@"jvmType == %ld AND isLTS == %@ AND isEA == %@ AND downloadURLForCurrentArchitecture != nil", MTSapMachineJVMTypeJDK, [NSNumber numberWithBool:YES], [NSNumber numberWithBool:NO]]; 40 | NSArray *ltsJDKs = [_assetCatalog filteredArrayUsingPredicate:predicate]; 41 | 42 | // if we got a release and it is not already installed, we display a checkbox 43 | // allowing the user to install the recommended version of SapMachine 44 | if ([ltsJDKs count] > 0) { 45 | 46 | // sort the returned assets by version number and get the highest one 47 | NSArray *sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"currentVersion.majorVersion" 48 | ascending:NO 49 | ] 50 | ]; 51 | NSArray *sortedAssets = [ltsJDKs sortedArrayUsingDescriptors:sortDescriptors]; 52 | MTSapMachineAsset *recommendedAsset = [sortedAssets firstObject]; 53 | if (![recommendedAsset installURL]) { _toBeInstalled = recommendedAsset; } 54 | } 55 | 56 | if (_toBeInstalled) { 57 | 58 | [_installRecommended setState:(_skipRecommended) ? NSControlStateValueOff : NSControlStateValueOn]; 59 | [_installRecommendedView setHidden:NO]; 60 | 61 | } else { 62 | 63 | [_installRecommended setState:NSControlStateValueOff]; 64 | [_installRecommendedView setHidden:YES]; 65 | } 66 | } 67 | 68 | - (IBAction)goToNextStep:(id)sender 69 | { 70 | if ([_installRecommended state] == NSControlStateValueOn) { 71 | 72 | [self performSegueWithIdentifier:@"corp.sap.SapMachineManager.Install.recommended" sender:_toBeInstalled]; 73 | 74 | } else { 75 | 76 | [self performSegueWithIdentifier:@"corp.sap.SapMachineManager.Install.step1" sender:nil]; 77 | } 78 | } 79 | 80 | - (void)prepareForSegue:(NSStoryboardSegue *)segue sender:(id)sender 81 | { 82 | if ([[segue identifier] isEqualToString:@"corp.sap.SapMachineManager.Install.recommended"]) { 83 | 84 | MTInstallController *destController = [segue destinationController]; 85 | [destController setSelectedAsset:(MTSapMachineAsset*)sender]; 86 | 87 | } else { 88 | 89 | MTPackageReleaseSelectController *destController = [segue destinationController]; 90 | [destController setIsInstall:YES]; 91 | [destController setAssetCatalog:_assetCatalog]; 92 | } 93 | } 94 | 95 | @end 96 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | # SapMachine Manager 6 | 7 | [![REUSE status](https://api.reuse.software/badge/github.com/SAP/sapmachine-manager-for-macos)](https://api.reuse.software/info/github.com/SAP/sapmachine-manager-for-macos) 8 | 9 | _SapMachine Manager_ is a handy and easy-to-use tool allowing Mac users to easily install, uninstall, manage, and automatically update one or more instances of [SapMachine](https://sapmachine.io/) on a Mac. _SapMachine_ is a version of OpenJDK maintained and supported by SAP. Additionally, the app supports the creation of _SapMachine_ installer packages for macOS and the definition of the default Java environment. _SapMachine Manager_ can be deployed and managed via MDM. 10 | 11 | _SapMachine Manager_ is the standard tool within SAP to install _SapMachine_ on macOS. 12 | 13 |
14 | 15 | # Features 16 | 17 | 🛠️ Easy install 18 | 19 | 🔓 Install and uninstall SapMachine without admin rights 20 | 21 | ✅ Automatic download and install of new SapMachine releases 22 | 23 | 🔔 Update notifications 24 | 25 | 📦 Create SapMachine installer packages 26 | 27 | 💻 For macOS 13 and newer 28 | 29 |
30 | 31 | # Demo 32 | 33 | Have a look at how quick and easy a new SapMachine release can be installed: 34 | 35 | https://github.com/user-attachments/assets/507afc68-de79-4a05-a523-489ca5257108 36 | 37 |
38 | 39 | # Documentation 40 | 41 | To learn more about _SapMachine Manager's_ features, make sure to take a look at our [wiki](https://github.com/SAP/sapmachine-manager-for-macos/wiki) or the links below: 42 | 43 | * [Installation](https://github.com/SAP/sapmachine-manager-for-macos/wiki/Installation) 44 | * [Uninstallation](https://github.com/SAP/sapmachine-manager-for-macos/wiki/Uninstallation) 45 | * [Install a new _SapMachine_ release](https://github.com/SAP/sapmachine-manager-for-macos/wiki/Install-a-new-SapMachine-release) 46 | * [Uninstall a _SapMachine_ release](https://github.com/SAP/sapmachine-manager-for-macos/wiki/Uninstall-a-SapMachine-release) 47 | * [Create _SapMachine_ installer packages](https://github.com/SAP/sapmachine-manager-for-macos/wiki/Create-SapMachine-installer-packages) 48 | * [How to deactivate automatic updates](https://github.com/SAP/sapmachine-manager-for-macos/wiki/How-to-deactivate-automatic-updates) 49 | * [How to turn off notifications](https://github.com/SAP/sapmachine-manager-for-macos/wiki/How-to-turn-off-notifications) 50 | * [How to open the log window](https://github.com/SAP/sapmachine-manager-for-macos/wiki/How-to-open-the-log-window) 51 | * [Legend](https://github.com/SAP/sapmachine-manager-for-macos/wiki/Legend) 52 | 53 |
54 | 55 | # Support, Feedback, Contributing 56 | 57 | This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP/sapmachine-manager-for-macos/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](CONTRIBUTING.md). 58 | 59 |
60 | 61 | # Security / Disclosure 62 | If you find any bug that may be a security problem, please follow our instructions at [in our security policy](https://github.com/SAP/sapmachine-manager-for-macos/security/policy) on how to report it. Please do not create GitHub issues for security-related doubts or problems. 63 | 64 |
65 | 66 | # Code of Conduct 67 | 68 | We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its [Code of Conduct](https://github.com/SAP/.github/blob/main/CODE_OF_CONDUCT.md) at all times. 69 | 70 |
71 | 72 | # License 73 | 74 | Copyright 2024-2025 SAP SE or an SAP affiliate company and SapMachine Manager contributors. Please see our [LICENSE](LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/sapmachine-manager-for-macos). 75 | -------------------------------------------------------------------------------- /source/SapMachine Manager/Classes/MTTableView.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTTableView.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTTableView.h" 19 | #import "MTSapMachineUser.h" 20 | #import "MTSapMachineAsset.h" 21 | #import "Constants.h" 22 | 23 | @implementation MTTableView 24 | 25 | - (NSMenu *)menuForEvent:(NSEvent *)event 26 | { 27 | [super menuForEvent:event]; 28 | 29 | NSMenu *theMenu = nil; 30 | NSInteger clickedRow = [self clickedRow]; 31 | NSIndexSet *selectedRowIndexes = [self selectedRowIndexes]; 32 | NSInteger numberOfSelectedRows = [selectedRowIndexes count]; 33 | 34 | if (clickedRow >= 0) { 35 | 36 | // add an item for deleting one or more assets 37 | NSMenuItem *removeItem = [[self menu] itemWithTag:3000]; 38 | 39 | if ([selectedRowIndexes containsIndex:clickedRow] && numberOfSelectedRows > 1) { 40 | [removeItem setTitle:[NSString localizedStringWithFormat:NSLocalizedString(@"deleteSelectedMenuEntry", nil), numberOfSelectedRows]]; 41 | } else { 42 | [removeItem setTitle:NSLocalizedString(@"deleteOneMenuEntry", nil)]; 43 | } 44 | 45 | // add an item for updating one or more assets 46 | NSMenuItem *updateItem = [[self menu] itemWithTag:2000]; 47 | 48 | NSIndexSet *toBeUpdated = nil; 49 | 50 | if (clickedRow == NSUIntegerMax || [selectedRowIndexes containsIndex:clickedRow]) { 51 | toBeUpdated = selectedRowIndexes; 52 | } else { 53 | toBeUpdated = [NSIndexSet indexSetWithIndex:clickedRow]; 54 | } 55 | 56 | __block NSInteger selectedUpdateAssets = ([selectedRowIndexes containsIndex:clickedRow] && numberOfSelectedRows > 1) ? numberOfSelectedRows : 1; 57 | 58 | [toBeUpdated enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) { 59 | 60 | NSTableCellView *cellView = [self viewAtColumn:0 row:idx makeIfNecessary:NO]; 61 | 62 | if (cellView) { 63 | 64 | MTSapMachineAsset *asset = (MTSapMachineAsset*)[cellView objectValue]; 65 | if (!asset || ([[asset currentVersion] compare:[asset installedVersion]] != NSOrderedDescending) || [[asset downloadURLs] count] == 0) { selectedUpdateAssets--; } 66 | } 67 | }]; 68 | 69 | if (selectedUpdateAssets > 0) { 70 | [updateItem setAction:NSSelectorFromString(@"updateAsset:")]; 71 | } else { 72 | [updateItem setAction:nil]; 73 | } 74 | 75 | if (selectedUpdateAssets > 1) { 76 | [updateItem setTitle:[NSString localizedStringWithFormat:NSLocalizedString(@"updateSelectedMenuEntry", nil), selectedUpdateAssets]]; 77 | } else { 78 | [updateItem setTitle:NSLocalizedString(@"updateOneMenuEntry", nil)]; 79 | } 80 | 81 | NSMenuItem *javaHomeItem = [[self menu] itemWithTag:1100]; 82 | [javaHomeItem setAction:nil]; 83 | 84 | if (numberOfSelectedRows == 0 || 85 | (numberOfSelectedRows == 1 && [selectedRowIndexes containsIndex:clickedRow]) || 86 | (numberOfSelectedRows >= 1 && ![selectedRowIndexes containsIndex:clickedRow])) { 87 | 88 | NSTableCellView *cellView = [self viewAtColumn:0 row:clickedRow makeIfNecessary:NO]; 89 | 90 | if (cellView) { 91 | 92 | MTSapMachineAsset *asset = (MTSapMachineAsset*)[cellView objectValue]; 93 | 94 | if (asset && [[[asset javaHomeConfigFilePaths] allKeys] count] == 0) { 95 | [javaHomeItem setAction:NSSelectorFromString(@"setJavaHome:")]; 96 | } else { 97 | [javaHomeItem setAction:nil]; 98 | } 99 | } 100 | } 101 | 102 | theMenu = [self menu]; 103 | } 104 | 105 | return theMenu; 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSystemInfo.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTSystemInfo.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTSystemInfo.h" 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import "Constants.h" 25 | 26 | @implementation MTSystemInfo : NSObject 27 | 28 | typedef struct kinfo_proc kinfo_proc; 29 | 30 | + (NSArray*)processList 31 | { 32 | NSMutableArray *processList = [[NSMutableArray alloc] init]; 33 | 34 | int numberOfProcesses = proc_listpids(PROC_ALL_PIDS, 0, NULL, 0); 35 | pid_t pids[numberOfProcesses]; 36 | bzero(pids, sizeof(pids)); 37 | proc_listpids(PROC_ALL_PIDS, 0, pids, (int)sizeof(pids)); 38 | 39 | for (int i = 0; i < numberOfProcesses; ++i) { 40 | 41 | if (pids[i] == 0) { continue; } 42 | char pathBuffer[PROC_PIDPATHINFO_MAXSIZE]; 43 | bzero(pathBuffer, PROC_PIDPATHINFO_MAXSIZE); 44 | proc_pidpath(pids[i], pathBuffer, sizeof(pathBuffer)); 45 | 46 | if (strlen(pathBuffer) > 0) { 47 | NSString *processPath = [NSString stringWithUTF8String:pathBuffer]; 48 | [processList addObject:processPath]; 49 | } 50 | } 51 | 52 | return ([processList count] > 0) ? processList : nil; 53 | } 54 | 55 | + (NSString*)hardwareArchitecture 56 | { 57 | NSString *returnValue = nil; 58 | struct utsname sysinfo; 59 | 60 | if (uname(&sysinfo) == EXIT_SUCCESS) { 61 | 62 | NSString *archString = [NSString stringWithUTF8String:sysinfo.machine]; 63 | 64 | // check if we run in Rosetta 65 | if ([archString isEqualToString:@"x86_64"]) { 66 | 67 | int ret = 0; 68 | size_t size = sizeof(ret); 69 | 70 | if (sysctlbyname("sysctl.proc_translated", &ret, &size, NULL, 0) == 0) { 71 | if (ret == 1) { archString = @"arm64"; } 72 | } 73 | } 74 | 75 | returnValue = archString; 76 | } 77 | 78 | return returnValue; 79 | } 80 | 81 | + (NSDate*)processStartTime 82 | { 83 | NSDate *startTime = nil; 84 | 85 | size_t len = 4; 86 | int mib[len]; 87 | struct kinfo_proc kp; 88 | 89 | if (sysctlnametomib("kern.proc.pid", mib, &len) == 0) { 90 | 91 | mib[3] = getpid(); 92 | len = sizeof(kp); 93 | 94 | if (sysctl(mib, 4, &kp, &len, NULL, 0) == 0) { 95 | 96 | struct timeval processStartTime = kp.kp_proc.p_un.__p_starttime; 97 | startTime = [NSDate dateWithTimeIntervalSince1970:processStartTime.tv_sec + processStartTime.tv_usec / 1e6]; 98 | } 99 | } 100 | 101 | return startTime; 102 | } 103 | 104 | + (BOOL)isAdminUser:(NSString*)userName error:(NSError**)error 105 | { 106 | BOOL isMember = NO; 107 | NSString *errorMsg; 108 | 109 | // get the identity for the user 110 | CBIdentity *userIdentity = [CBIdentity identityWithName:userName 111 | authority:[CBIdentityAuthority defaultIdentityAuthority]]; 112 | 113 | if (userIdentity) { 114 | 115 | // get the identity of the admin group 116 | CBGroupIdentity *groupIdentity = [CBGroupIdentity groupIdentityWithPosixGID:kMTAdminGroupID 117 | authority:[CBIdentityAuthority localIdentityAuthority]]; 118 | 119 | if (groupIdentity) { 120 | 121 | // check if the user is currently a member of the admin group 122 | isMember = [userIdentity isMemberOfGroup:groupIdentity]; 123 | 124 | } else { 125 | 126 | errorMsg = @"Unable to get group identity"; 127 | } 128 | 129 | } else { 130 | 131 | errorMsg = @"Unable to get user identity"; 132 | } 133 | 134 | if (errorMsg != nil && error != nil) { 135 | NSDictionary *errorDetail = [NSDictionary dictionaryWithObject:errorMsg forKey:NSLocalizedDescriptionKey]; 136 | *error = [NSError errorWithDomain:kMTErrorDomain code:0 userInfo:errorDetail]; 137 | } 138 | 139 | return isMember; 140 | } 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTJavaHome.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTJavaHome.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | 20 | /*! 21 | @class MTJavaHome 22 | @abstract This class provides methods to get information about the Java Virtual Machines 23 | currently installed on the machine. 24 | */ 25 | 26 | @interface MTJavaHome : NSObject 27 | 28 | /*! 29 | @method installedJVMsWithCompletionHandler: 30 | @abstract Returns all installed Java Virtual Machines. 31 | @param completionHandler The completion handler to call when the request is complete. 32 | @discussion Returns an NSArray containing a NSDictionary for each installed jvm 33 | or nil if an error occurred. 34 | */ 35 | + (void)installedJVMsWithCompletionHandler:(void (^) (NSArray *installedJVMs))completionHandler; 36 | 37 | /*! 38 | @method installedJVMsFilteredByBundleID: 39 | @abstract Returns all installed Java Virtual Machines using the given bundle identifers. 40 | @param bundleID An array of bundle identifiers. 41 | @param completionHandler The completion handler to call when the request is complete. 42 | @discussion Returns an NSArray containing a NSDictionary for each installed jvm 43 | matching one of the given bundle identifiers or nil if an error occurred. 44 | */ 45 | + (void)installedJVMsFilteredByBundleID:(NSArray*)bundleID completionHandler:(void (^) (NSArray *array))completionHandler; 46 | 47 | /*! 48 | @method configFilesWithUserName:userOnly:recommendedOnly: 49 | @abstract Returns all installed Java Virtual Machines using the given bundle identifers. 50 | @param userName The name of the user to get the config files for. 51 | @param userOnly If set to YES, only the config files that belong to the user are returned, 52 | otherwise also system-wide config files are returned. 53 | @param recommendedOnly If set to YES, only the files recommended to set the @c JAVA_HOME 54 | environment variable (for each supported shell) are returned. Otherwise the paths of all 55 | config files (for each supported shell) are returned. 56 | @discussion Returns an NSDictionary containing the paths to the config files of the supported shells. 57 | */ 58 | + (NSDictionary*)configFilesWithUserName:(NSString*)userName userOnly:(BOOL)userOnly recommendedOnly:(BOOL)recommendedOnly; 59 | 60 | /*! 61 | @method environmentVariableAtPath: 62 | @abstract Returns the content of the @c JAVA_HOME environment variable for config file at the given path. 63 | @param path The path to the config file (like @c /etc/zshenv or @c /Users/xyz/.zshenv). 64 | @discussion Returns the file url of the jvm configured in the @c JAVA_HOME environment variable or nil if the variable is not set 65 | or if an error occurred. 66 | */ 67 | + (NSString*)environmentVariableAtPath:(NSString*)path; 68 | 69 | /*! 70 | @method setEnvironmentVariableAtPaths:usingJVMPath:completionHandler: 71 | @abstract Sets the @c JAVA_HOME environment variable at the given paths to the given jvm path. 72 | @param paths The paths to the files the environment variable should be set.. 73 | @param jvmPath The path to the jvm that should be used for the environment variable. 74 | @param completionHandler The completion handler to call when the request is complete. 75 | @discussion Returns YES if the given files have been changed successfully, otherwise returns NO. 76 | */ 77 | + (void)setEnvironmentVariableAtPaths:(NSArray*)paths usingJVMPath:(NSString*)jvmPath completionHandler:(void (^) (BOOL success))completionHandler; 78 | 79 | /*! 80 | @method unsetEnvironmentVariableAtPaths:completionHandler: 81 | @abstract Returns the content of the @c JAVA_HOME environment variable for the shell at the given path and the given user. 82 | @param paths The path to the shell (like @c /bin/bash or @c /bin/zsh). 83 | @param completionHandler The completion handler to call when the request is complete. 84 | @discussion Returns the file url of the jvm configured in the @c JAVA_HOME environment variable or nil if the variable is not set 85 | or if an error occurred. 86 | */ 87 | + (void)unsetEnvironmentVariableAtPaths:(NSArray*)paths completionHandler:(void (^) (NSArray *changedFiles))completionHandler; 88 | 89 | @end 90 | -------------------------------------------------------------------------------- /source/SapMachine Manager/SapMachine Manager.mobileconfig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | 21 | 22 | PayloadContent 23 | 24 | 25 | PayloadContent 26 | 27 | corp.sap.SMUDaemon 28 | 29 | Forced 30 | 31 | 32 | mcx_preference_settings 33 | 34 | 35 | 44 | AutomaticUpdatesEnabled 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | PayloadDescription 53 | 54 | PayloadDisplayName 55 | SMUDaemon configuration 56 | PayloadEnabled 57 | 58 | PayloadIdentifier 59 | com.apple.ManagedClient.preferences.9C2A1DA6-FC14-493F-8569-5CBD642E219A 60 | PayloadOrganization 61 | SAP SE 62 | PayloadType 63 | com.apple.ManagedClient.preferences 64 | PayloadUUID 65 | 9C2A1DA6-FC14-493F-8569-5CBD642E219A 66 | PayloadVersion 67 | 1 68 | 69 | 70 | 71 | PayloadContent 72 | 73 | corp.sap.SapMachineManager 74 | 75 | Forced 76 | 77 | 78 | mcx_preference_settings 79 | 80 | 81 | 90 | DontRequireAdminUser 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | PayloadDescription 99 | 100 | PayloadDisplayName 101 | SapMachine Manager configuration 102 | PayloadEnabled 103 | 104 | PayloadIdentifier 105 | com.apple.ManagedClient.preferences.62D23088-81E1-4E45-96BD-B7E71CEEDDF6 106 | PayloadOrganization 107 | SAP SE 108 | PayloadType 109 | com.apple.ManagedClient.preferences 110 | PayloadUUID 111 | 6B0A1013-C3C5-4D2C-A797-8D125364FD4A 112 | PayloadVersion 113 | 1 114 | 115 | 116 | PayloadDescription 117 | Configures the SapMachine Manager. 118 | PayloadDisplayName 119 | SapMachine Manager configuration 120 | PayloadIdentifier 121 | 20C5AE10-BC67-462C-9363-02A89BAC23FC 122 | PayloadOrganization 123 | SAP SE 124 | PayloadRemovalDisallowed 125 | 126 | PayloadScope 127 | System 128 | PayloadType 129 | Configuration 130 | PayloadUUID 131 | D7D4F8FC-A838-40B2-94C6-3FFD9A3728B4 132 | PayloadVersion 133 | 1 134 | 135 | 136 | -------------------------------------------------------------------------------- /application_management/example_profile/SapMachine Install Manager.mobileconfig: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | 21 | 22 | PayloadContent 23 | 24 | 25 | PayloadContent 26 | 27 | corp.sap.SMUDaemon 28 | 29 | Forced 30 | 31 | 32 | mcx_preference_settings 33 | 34 | 35 | 44 | AutomaticUpdatesEnabled 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | PayloadDescription 53 | 54 | PayloadDisplayName 55 | SMUDaemon configuration 56 | PayloadEnabled 57 | 58 | PayloadIdentifier 59 | com.apple.ManagedClient.preferences.9C2A1DA6-FC14-493F-8569-5CBD642E219A 60 | PayloadOrganization 61 | SAP SE 62 | PayloadType 63 | com.apple.ManagedClient.preferences 64 | PayloadUUID 65 | 9C2A1DA6-FC14-493F-8569-5CBD642E219A 66 | PayloadVersion 67 | 1 68 | 69 | 70 | 71 | PayloadContent 72 | 73 | corp.sap.SapMachineManager 74 | 75 | Forced 76 | 77 | 78 | mcx_preference_settings 79 | 80 | 81 | 90 | DontRequireAdminUser 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | PayloadDescription 99 | 100 | PayloadDisplayName 101 | SapMachine Manager configuration 102 | PayloadEnabled 103 | 104 | PayloadIdentifier 105 | com.apple.ManagedClient.preferences.62D23088-81E1-4E45-96BD-B7E71CEEDDF6 106 | PayloadOrganization 107 | SAP SE 108 | PayloadType 109 | com.apple.ManagedClient.preferences 110 | PayloadUUID 111 | 6B0A1013-C3C5-4D2C-A797-8D125364FD4A 112 | PayloadVersion 113 | 1 114 | 115 | 116 | PayloadDescription 117 | Configures the SapMachine Manager. 118 | PayloadDisplayName 119 | SapMachine Manager configuration 120 | PayloadIdentifier 121 | 20C5AE10-BC67-462C-9363-02A89BAC23FC 122 | PayloadOrganization 123 | SAP SE 124 | PayloadRemovalDisallowed 125 | 126 | PayloadScope 127 | System 128 | PayloadType 129 | Configuration 130 | PayloadUUID 131 | D7D4F8FC-A838-40B2-94C6-3FFD9A3728B4 132 | PayloadVersion 133 | 1 134 | 135 | 136 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachineVersion.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachineVersion.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTSapMachineVersion.h" 19 | 20 | @interface MTSapMachineVersion () 21 | @property (nonatomic, strong, readwrite) NSString *versionString; 22 | @property (nonatomic, strong, readwrite) NSString *normalizedVersionString; 23 | @property (assign) NSUInteger majorVersion; 24 | @end 25 | 26 | @implementation MTSapMachineVersion 27 | 28 | - (instancetype)initWithCoder:(NSCoder*)aDecoder 29 | { 30 | self = [super init]; 31 | 32 | if (self) { 33 | 34 | _versionString = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"versionString"]; 35 | _normalizedVersionString = [aDecoder decodeObjectOfClass:[NSString class] forKey:@"normalizedVersionString"]; 36 | _majorVersion = [aDecoder decodeIntegerForKey:@"majorVersion"]; 37 | } 38 | 39 | return self; 40 | } 41 | 42 | - (void)encodeWithCoder:(NSCoder*)aCoder 43 | { 44 | [aCoder encodeObject:_versionString forKey:@"versionString"]; 45 | [aCoder encodeObject:_normalizedVersionString forKey:@"normalizedVersionString"]; 46 | [aCoder encodeInteger:_majorVersion forKey:@"majorVersion"]; 47 | } 48 | 49 | + (BOOL)supportsSecureCoding 50 | { 51 | return YES; 52 | } 53 | 54 | - (id)copyWithZone:(NSZone *)zone 55 | { 56 | MTSapMachineVersion *newVersion = [[[self class] allocWithZone:zone] initWithVersionString:_versionString]; 57 | return newVersion; 58 | } 59 | 60 | - (instancetype)initWithVersionString:(NSString *)versionString 61 | { 62 | self = [super init]; 63 | 64 | if (self) { 65 | 66 | if ([versionString length] > 0) { 67 | 68 | _versionString = [self strippedVersionStringWithString:versionString]; 69 | 70 | NSArray *versionComponents = [NSArray arrayWithArray:[self versionComponentsWithString:_versionString]]; 71 | _normalizedVersionString = [versionComponents componentsJoinedByString:@"."]; 72 | _majorVersion = [[versionComponents firstObject] integerValue]; 73 | 74 | } else { 75 | self = nil; 76 | } 77 | } 78 | 79 | return self; 80 | } 81 | 82 | - (NSString*)strippedVersionStringWithString:(NSString*)versionString 83 | { 84 | NSMutableCharacterSet *allowedCharacters = [NSMutableCharacterSet decimalDigitCharacterSet]; 85 | [allowedCharacters addCharactersInString:@"+."]; 86 | versionString = [[versionString componentsSeparatedByCharactersInSet:[allowedCharacters invertedSet]] componentsJoinedByString:@""]; 87 | 88 | return versionString; 89 | } 90 | 91 | - (NSArray*)versionComponentsWithString:(NSString*)versionString 92 | { 93 | versionString = [self strippedVersionStringWithString:versionString]; 94 | 95 | // get the parts of the version number 96 | NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"^(\\d+)(?:\\.(\\d+))?(?:\\.(\\d+))?(?:\\.(\\d+))?(?:\\.(\\d+))?(?:\\.(\\d+))?" options:NSRegularExpressionCaseInsensitive error:nil]; 97 | NSTextCheckingResult *result = [regex firstMatchInString:versionString options:kNilOptions range:NSMakeRange(0, [versionString length])]; 98 | 99 | // checking for capturing groups 100 | NSMutableArray *versionArray = [[NSMutableArray alloc] init]; 101 | 102 | for (int i = 1; i < [result numberOfRanges]; i++) { 103 | 104 | NSNumber *versionNumberPart = [NSNumber numberWithInt:0]; 105 | 106 | if ([result rangeAtIndex:i].location != NSNotFound) { 107 | versionNumberPart = [NSNumber numberWithInt:[[versionString substringWithRange:[result rangeAtIndex:i]] intValue]]; 108 | } 109 | 110 | [versionArray addObject:versionNumberPart]; 111 | } 112 | 113 | // get the build number 114 | NSNumber *buildNumber = [NSNumber numberWithInt:0]; 115 | NSRange range = [versionString rangeOfString:@"+"]; 116 | 117 | if (range.location != NSNotFound) { 118 | buildNumber = [NSNumber numberWithInt:[[versionString substringFromIndex:range.location + 1] intValue]]; 119 | } 120 | 121 | [versionArray addObject:buildNumber]; 122 | 123 | return versionArray; 124 | } 125 | 126 | - (NSComparisonResult)compare:(MTSapMachineVersion*)version 127 | { 128 | NSComparisonResult result = [[self normalizedVersionString] compare:[version normalizedVersionString] options:NSNumericSearch]; 129 | 130 | return result; 131 | } 132 | 133 | - (NSDictionary*)dictionaryRepresentation 134 | { 135 | NSMutableDictionary *dict = [[NSMutableDictionary alloc] init]; 136 | 137 | unsigned count = 0; 138 | objc_property_t *properties = class_copyPropertyList([self class], &count); 139 | 140 | if (properties) { 141 | 142 | for (int i = 0; i < count; i++) { 143 | 144 | NSString *propertyKey = [NSString stringWithUTF8String:property_getName(properties[i])]; 145 | [dict setObject:([self valueForKey:propertyKey]) ? [self valueForKey:propertyKey] : @"" 146 | forKey:propertyKey 147 | ]; 148 | } 149 | 150 | free(properties); 151 | } 152 | 153 | return dict; 154 | } 155 | 156 | @end 157 | -------------------------------------------------------------------------------- /source/SMUDaemon/MTCodeSigning.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTCodeSigning.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTCodeSigning.h" 19 | 20 | @implementation MTCodeSigning 21 | 22 | + (NSString*)getSigningAuthorityWithError:(NSError**)error 23 | { 24 | OSStatus result = errSecSuccess; 25 | SecCodeRef helperCodeRef = NULL; 26 | NSString *returnValue = nil; 27 | NSString *errorMsg = nil; 28 | 29 | // get our code object 30 | result = SecCodeCopySelf(kSecCSDefaultFlags, &helperCodeRef); 31 | 32 | if (result != errSecSuccess) { 33 | 34 | errorMsg = [NSString stringWithFormat:@"Failed to copy code object: %d", result]; 35 | 36 | } else { 37 | 38 | // get our static code 39 | SecStaticCodeRef staticCodeRef = NULL; 40 | result = SecCodeCopyStaticCode(helperCodeRef, kSecCSDefaultFlags, &staticCodeRef); 41 | 42 | if (result != errSecSuccess) { 43 | 44 | errorMsg = [NSString stringWithFormat:@"Failed to get static code object: %d", result]; 45 | 46 | } else { 47 | 48 | // get our own signing information 49 | CFDictionaryRef signingInfo = NULL; 50 | result = SecCodeCopySigningInformation(staticCodeRef, kSecCSSigningInformation, &signingInfo); 51 | 52 | if (result != errSecSuccess) { 53 | 54 | errorMsg = [NSString stringWithFormat:@"Failed to get signing information: %d", result]; 55 | 56 | } else { 57 | 58 | CFArrayRef certChain = (CFArrayRef) CFDictionaryGetValue(signingInfo, kSecCodeInfoCertificates); 59 | 60 | if (certChain && CFGetTypeID(certChain) == CFArrayGetTypeID() && CFArrayGetCount(certChain) > 0) { 61 | 62 | SecCertificateRef issuerCert = (SecCertificateRef) CFArrayGetValueAtIndex(certChain, 0); 63 | 64 | if (issuerCert) { 65 | 66 | CFStringRef subjectCN = NULL; 67 | SecCertificateCopyCommonName(issuerCert, &subjectCN); 68 | if (subjectCN) { returnValue = CFBridgingRelease(subjectCN); } 69 | } 70 | } 71 | } 72 | 73 | if (signingInfo) { CFRelease(signingInfo); } 74 | } 75 | 76 | if (staticCodeRef) { CFRelease(staticCodeRef); } 77 | } 78 | 79 | if (helperCodeRef) { CFRelease(helperCodeRef); } 80 | 81 | if (errorMsg && error) { 82 | 83 | NSDictionary *errorDetail = [NSDictionary dictionaryWithObjectsAndKeys:errorMsg, NSLocalizedDescriptionKey, nil]; 84 | *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:100 userInfo:errorDetail]; 85 | } 86 | 87 | return returnValue; 88 | } 89 | 90 | + (NSString*)codeSigningRequirementsWithCommonName:(NSString*)commonName 91 | bundleIdentifier:(NSString*)bundleIdentifier 92 | versionString:(NSString*)versionString 93 | { 94 | NSString *reqString = [NSString stringWithFormat:@"anchor trusted and certificate leaf [subject.CN] = \"%@\" and info [CFBundleShortVersionString] >= \"%@\" and info [CFBundleIdentifier] = %@", commonName, versionString, bundleIdentifier]; 95 | 96 | return reqString; 97 | } 98 | 99 | + (void)sandboxStatusWithCompletionHandler:(void (^)(BOOL isSandboxed, NSError *error))completionHandler 100 | { 101 | if (completionHandler) { 102 | 103 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 104 | 105 | BOOL isSandboxed = NO; 106 | NSError *error = nil; 107 | 108 | SecCodeRef codeRef = NULL; 109 | CFDictionaryRef infoDict = NULL; 110 | CFTypeRef entitlements = NULL; 111 | 112 | OSStatus err = SecCodeCopySelf(kSecCSDefaultFlags, &codeRef); 113 | 114 | if (err == errSecSuccess) { 115 | 116 | err = SecCodeCopySigningInformation(codeRef, (SecCSFlags) kSecCSDynamicInformation, &infoDict); 117 | 118 | if (err == errSecSuccess) { 119 | 120 | if (CFDictionaryGetValueIfPresent(infoDict, kSecCodeInfoEntitlementsDict, &entitlements)) { 121 | 122 | if (entitlements != NULL && CFDictionaryGetValue(entitlements, CFSTR("com.apple.security.app-sandbox")) != NULL) { 123 | 124 | isSandboxed = YES; 125 | } 126 | 127 | } else { 128 | 129 | err = errSecMissingEntitlement; 130 | } 131 | } 132 | } 133 | 134 | if (err != errSecSuccess) { error = [NSError errorWithDomain:NSOSStatusErrorDomain code:err userInfo:nil]; } 135 | 136 | completionHandler(isSandboxed, error); 137 | }); 138 | } 139 | } 140 | 141 | @end 142 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachine.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachine.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "MTSapMachineAsset.h" 20 | #import "Constants.h" 21 | 22 | /*! 23 | @protocol MTSapMachineAssetUpdateDelegate 24 | @abstract Defines an interface for delegates of MTSapMachine to be notified about an asset's update progress. 25 | */ 26 | @protocol MTSapMachineAssetUpdateDelegate 27 | 28 | /*! 29 | @method updateStartedForAsset: 30 | @abstract Called if the update of a MTSapMachineAsset has been started. 31 | @param asset A reference to the MTSapMachineAsset instance that has changed. 32 | @discussion Delegates receive this message before the download of a MTSapMachineAsset 33 | will start. 34 | */ 35 | - (void)updateStartedForAsset:(MTSapMachineAsset*)asset; 36 | 37 | /*! 38 | @method updateFinishedForAsset: 39 | @abstract Called if the update of a MTSapMachineAsset has been successfully finished. 40 | @param asset A reference to the MTSapMachineAsset instance that has changed. 41 | @discussion Delegates receive this message after the download of a MTSapMachineAsset 42 | has been finished, the checksum has been successfully verified and the 43 | downloaded archive has been successfully unpacked. 44 | */ 45 | - (void)updateFinishedForAsset:(MTSapMachineAsset*)asset; 46 | 47 | /*! 48 | @method updateFailedForAsset: 49 | @abstract Called if the update of a MTSapMachineAsset failed. 50 | @param asset A reference to the MTSapMachineAsset instance that has changed. 51 | @param error The error that caused the update to fail. 52 | @discussion Delegates receive this message if the download of a MTSapMachineAsset 53 | failed, if the checksum of the downloaded file could not be verified or if 54 | the downloaded archive could not be unpacked. 55 | */ 56 | - (void)updateFailedForAsset:(MTSapMachineAsset*)asset withError:(NSError*)error; 57 | 58 | /*! 59 | @method downloadProgressUpdatedForAsset: 60 | @abstract Called if the update progress of a MTSapMachineAsset changed. 61 | @param asset A reference to the MTSapMachineAsset instance that has changed. 62 | @discussion Periodically informs the delegate about the update progress. The update 63 | progress is provided in the asset's @c updateProgress property. 64 | */ 65 | - (void)downloadProgressUpdatedForAsset:(MTSapMachineAsset*)asset; 66 | 67 | @end 68 | 69 | /*! 70 | @class MTSapMachine 71 | @abstract This class provides methods to get SapMachine release infromation and download, 72 | verfiy and install SapMachine releases. 73 | */ 74 | 75 | @interface MTSapMachine : NSObject 76 | 77 | /*! 78 | @property updateDelegate 79 | @abstract The receiver's update delegate. 80 | @discussion The value of this property is an object conforming to the MTSapMachineAssetUpdateDelegate protocol. 81 | */ 82 | @property (weak) id updateDelegate; 83 | 84 | 85 | @property (nonatomic, strong, readwrite) NSString *effectiveUserName; 86 | 87 | /*! 88 | @method init 89 | @discussion The init method is not available. Please use initWithURL: instead. 90 | */ 91 | - (instancetype)init NS_UNAVAILABLE; 92 | 93 | /*! 94 | @method initWithURL: 95 | @abstract Initialize a MTSapMachine object with a given url. 96 | @param url The url of the json file containing SapMachine release information. 97 | */ 98 | - (instancetype)initWithURL:(NSURL*)url NS_DESIGNATED_INITIALIZER; 99 | 100 | /*! 101 | @method requestReleaseDataWithCompletionHandler: 102 | @abstract Returns the SapMachine release data. 103 | @param completionHandler The completion handler to call when the request is complete. 104 | @discussion Returns a NSDictionary representation of the json release data. The dictionary may 105 | be nil if an error occurred. Then the NSError object might provide information about 106 | the error that caused the operation to fail. 107 | */ 108 | - (void)requestReleaseDataWithCompletionHandler:(void (^) (NSDictionary *releaseData, NSError *error))completionHandler; 109 | 110 | /*! 111 | @method assetCatalogWithCompletionHandler: 112 | @abstract Returns the asset catalog. 113 | @param completionHandler The completion handler to call when the request is complete. 114 | @discussion Returns a NSArray of MTSapMachine objects. Each element of the array represents 115 | a SapMachine release from the SapMachine release data. An empty array is returned 116 | if there are no release data available and no SapMachine assets are installed. The array 117 | may be nil if an error occurred. Then the NSError object might provide information about 118 | the error that caused the operation to fail. 119 | */ 120 | - (void)assetCatalogWithCompletionHandler:(void (^) (NSArray *assetCatalog, NSError *error))completionHandler; 121 | 122 | /*! 123 | @method downloadAssets:install:completionHandler: 124 | @abstract Downloads and optionally installs the given assets. 125 | @param assets An array of MTSapMachine objects. 126 | @param completionHandler The completion handler to call when the request is complete. 127 | @discussion Returns YES, if the operation was successful, otherwise returns NO. 128 | */ 129 | - (void)downloadAssets:(NSArray*)assets install:(BOOL)install completionHandler:(void (^) (BOOL success))completionHandler; 130 | 131 | @end 132 | -------------------------------------------------------------------------------- /source/SapMachineXPC/SapMachineXPC.m: -------------------------------------------------------------------------------- 1 | /* 2 | SapMachineXPC.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "SapMachineXPC.h" 19 | #import "SMUDaemonProtocol.h" 20 | #import "Constants.h" 21 | #import 22 | 23 | @interface SapMachineXPC () 24 | @property (assign) AuthorizationRef authRef; 25 | @property (atomic, strong, readwrite) NSXPCConnection *daemonConnection; 26 | @end 27 | 28 | @implementation SapMachineXPC 29 | 30 | - (void)connectToDaemon 31 | { 32 | if (!_daemonConnection) { 33 | 34 | _daemonConnection = [[NSXPCConnection alloc] initWithMachServiceName:kMTDaemonMachServiceName 35 | options:NSXPCConnectionPrivileged]; 36 | [_daemonConnection setRemoteObjectInterface:[NSXPCInterface interfaceWithProtocol:@protocol(SMUDaemonProtocol)]]; 37 | 38 | #pragma clang diagnostic push 39 | #pragma clang diagnostic ignored "-Warc-retain-cycles" 40 | [_daemonConnection setInvalidationHandler:^{ 41 | 42 | [self->_daemonConnection setInvalidationHandler:nil]; 43 | dispatch_async(dispatch_get_main_queue(), ^{ 44 | os_log(OS_LOG_DEFAULT, "SAPCorp: Daemon connection invalidated"); 45 | self->_daemonConnection = nil; 46 | }); 47 | }]; 48 | 49 | [_daemonConnection setInterruptionHandler:^{ 50 | 51 | [self->_daemonConnection setInterruptionHandler:nil]; 52 | dispatch_async(dispatch_get_main_queue(), ^{ 53 | os_log(OS_LOG_DEFAULT, "SAPCorp: Daemon connection interrupted"); 54 | self->_daemonConnection = nil; 55 | }); 56 | }]; 57 | #pragma clang diagnostic pop 58 | 59 | [_daemonConnection resume]; 60 | } 61 | } 62 | 63 | - (void)connectWithDaemonEndpointReply:(void(^)(NSXPCListenerEndpoint *endpoint))reply 64 | { 65 | [self connectToDaemon]; 66 | [[_daemonConnection remoteObjectProxyWithErrorHandler:^(NSError *error) { 67 | 68 | os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_FAULT, "SAPCorp: Failed to connect to daemon: %{public}@", error); 69 | reply(nil); 70 | 71 | }] connectWithEndpointReply:^(NSXPCListenerEndpoint *endpoint) { 72 | 73 | reply(endpoint); 74 | }]; 75 | } 76 | 77 | - (void)releaseFileFromQuarantineAtURL:(NSURL*)url recursive:(BOOL)recursive completionHandler:(void(^)(NSError *error))completionHandler 78 | { 79 | NSError *error = nil; 80 | 81 | BOOL isDirectory = NO; 82 | BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:[url path] isDirectory:&isDirectory]; 83 | 84 | if (exists) { 85 | if (recursive && isDirectory) { 86 | 87 | NSArray *allFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtURL:url 88 | includingPropertiesForKeys:[NSArray arrayWithObject:NSURLNameKey] 89 | options:NSDirectoryEnumerationSkipsHiddenFiles 90 | error:&error 91 | ]; 92 | 93 | if (!error) { 94 | 95 | for (NSURL *file in allFiles) { 96 | [file setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:&error]; 97 | if (error) { break; } 98 | } 99 | } 100 | 101 | } else { 102 | 103 | [url setResourceValue:[NSNull null] forKey:NSURLQuarantinePropertiesKey error:&error]; 104 | } 105 | } else { 106 | 107 | NSDictionary *errorDetail = [NSDictionary dictionaryWithObjectsAndKeys: 108 | @"The file or folder does not exist", NSLocalizedDescriptionKey, 109 | nil 110 | ]; 111 | error = [NSError errorWithDomain:kMTErrorDomain code:0 userInfo:errorDetail]; 112 | } 113 | 114 | if (completionHandler) { completionHandler(error); } 115 | } 116 | 117 | - (void)authenticateWithAuthorizationReply:(void (^)(NSData *authorization))reply 118 | { 119 | _authRef = NULL; 120 | NSData *authData = nil; 121 | 122 | AuthorizationItem authItem = {kAuthorizationRuleAuthenticateAsAdmin, 0, NULL, 0}; 123 | AuthorizationRights authRights = {1, &authItem}; 124 | AuthorizationFlags authFlags = (kAuthorizationFlagExtendRights | kAuthorizationFlagInteractionAllowed); 125 | 126 | NSString *dialogText = NSLocalizedString(@"authDialogMessage", nil); 127 | AuthorizationItem dialogItem = {kAuthorizationEnvironmentPrompt, strlen([dialogText UTF8String]), (char *)[dialogText UTF8String], 0}; 128 | AuthorizationEnvironment authEnvironment = {1, &dialogItem }; 129 | 130 | OSStatus status = AuthorizationCreate(&authRights, &authEnvironment, authFlags, &_authRef); 131 | 132 | if (status == errAuthorizationSuccess) { 133 | 134 | os_log(OS_LOG_DEFAULT, "SAPCorp: Authorization successful"); 135 | 136 | AuthorizationExternalForm extForm; 137 | status = AuthorizationMakeExternalForm(_authRef, &extForm); 138 | 139 | if (status == errAuthorizationSuccess) { 140 | authData = [[NSData alloc] initWithBytes:&extForm length:sizeof(extForm)]; 141 | } 142 | 143 | } else { 144 | 145 | NSError *error = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; 146 | os_log(OS_LOG_DEFAULT, "SAPCorp: Authorization failed: %{public}@", error); 147 | } 148 | 149 | reply(authData); 150 | } 151 | 152 | - (void)dealloc 153 | { 154 | if (_authRef != NULL) { 155 | AuthorizationFree(_authRef, kAuthorizationFlagDestroyRights); 156 | } 157 | } 158 | 159 | @end 160 | -------------------------------------------------------------------------------- /source/Shared/Classes/MTSapMachineAsset.h: -------------------------------------------------------------------------------- 1 | /* 2 | MTSapMachineAsset.h 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import 19 | #import "MTSapMachineVersion.h" 20 | 21 | /*! 22 | @class MTSapMachineAsset 23 | @abstract This class describes a SapMachine asset. 24 | */ 25 | 26 | @interface MTSapMachineAsset : NSObject 27 | 28 | /*! 29 | @enum MTSapMachineJVMType 30 | @abstract Specifies a jvm of type jre or jdk. 31 | @constant MTSapMachineJVMTypeJRE Specifies a Java Runtime Environment (JRE) 32 | @constant MTSapMachineJVMTypeJDK Specifies a Java Development Kit (JDK) 33 | */ 34 | typedef enum { 35 | MTSapMachineJVMTypeJRE = 0, 36 | MTSapMachineJVMTypeJDK = 1 37 | } MTSapMachineJVMType; 38 | 39 | /*! 40 | @property name 41 | @abstract A property to store the name of the asset. 42 | @discussion The value of this property is NSString. 43 | */ 44 | @property (nonatomic, strong, readwrite) NSString *name; 45 | 46 | /*! 47 | @property jvmType 48 | @abstract A property to store the jvm type of the asset. 49 | @discussion The value of this property is MTSapMachineJVMType. 50 | */ 51 | @property (assign, readonly) MTSapMachineJVMType jvmType; 52 | 53 | /*! 54 | @property installedVersion 55 | @abstract A property to store version information about the installed asset. 56 | @discussion The value of this property is MTSapMachineVersion. 57 | */ 58 | @property (nonatomic, strong, readwrite) MTSapMachineVersion *installedVersion; 59 | 60 | /*! 61 | @property currentVersion 62 | @abstract A property to store version information about the current version of the asset. 63 | @discussion The value of this property is MTSapMachineVersion. 64 | */ 65 | @property (nonatomic, strong, readwrite) MTSapMachineVersion *currentVersion; 66 | 67 | /*! 68 | @property installURL 69 | @abstract A property to store the url of the installed asset. 70 | @discussion The value of this property is NSURL. 71 | */ 72 | @property (nonatomic, strong, readwrite) NSURL *installURL; 73 | 74 | /*! 75 | @property javaHomeURL 76 | @abstract A property to store the home url of the installed asset. 77 | @discussion This propery might be used to set the @c JAVA_HOME environment variable. The value of this property is NSURL. 78 | */ 79 | @property (nonatomic, strong, readwrite) NSURL *javaHomeURL; 80 | 81 | /*! 82 | @property downloadURLs 83 | @abstract A property to store the available download urls (for the Mac platform) for the asset. 84 | @discussion The value of this property is NSDictionary. 85 | */ 86 | @property (nonatomic, strong, readwrite) NSDictionary *downloadURLs; 87 | 88 | /*! 89 | @property isEA 90 | @abstract A property to specify if the asset is an ea (pre-release) version. 91 | @discussion The value of this property is boolean. 92 | */ 93 | @property (assign, setter=setEA:) BOOL isEA; 94 | 95 | /*! 96 | @property isLTS 97 | @abstract A property to specify if the asset is a lts (long-term support) version. 98 | @discussion The value of this property is boolean. 99 | */ 100 | @property (assign, setter=setLTS:) BOOL isLTS; 101 | 102 | /*! 103 | @property isUpdating 104 | @abstract A property to specify if the asset is currently updated. 105 | @discussion The value of this property is boolean. 106 | */ 107 | @property (assign) BOOL isUpdating; 108 | 109 | /*! 110 | @property updateProgress 111 | @abstract A property to store the current update progress (in percent). 112 | @discussion The value of this property is double. 113 | */ 114 | @property (assign) double updateProgress; 115 | 116 | /*! 117 | @property isVerified 118 | @abstract A property to specify if the existence of the asset has been verified via Internet. 119 | @discussion The value of this property is boolean. 120 | */ 121 | @property (assign) BOOL isVerified; 122 | 123 | /*! 124 | @property javaHomeConfigFilePaths 125 | @abstract A property to specify the shell config files (like .zshenv or .bash_profile) that use the asset 126 | to set the @c JAVA_HOME environment variable. 127 | @discussion The value of this property is array. 128 | */ 129 | @property (nonatomic, strong, readwrite) NSDictionary *javaHomeConfigFilePaths; 130 | 131 | /*! 132 | @method init 133 | @discussion The init method is not available. Please use initWithType: instead. 134 | */ 135 | - (instancetype)init NS_UNAVAILABLE; 136 | 137 | /*! 138 | @method initWithType: 139 | @abstract Initialize a MTSapMachineAsset object with a given jvm type. 140 | @param type The type of the jvm (jre/jdk). 141 | */ 142 | - (instancetype)initWithType:(MTSapMachineJVMType)type NS_DESIGNATED_INITIALIZER; 143 | 144 | /*! 145 | @method isInUse 146 | @abstract Returns whether an asset is currently in use or not. 147 | @discussion Returns YES, if the asset is currently in use by a Java application, 148 | otherwise returns NO. 149 | */ 150 | - (BOOL)isInUse; 151 | 152 | /*! 153 | @method displayName 154 | @abstract Returns the display name for the asset. 155 | @discussion Returns an NSString object containing the name of the asset. For EA versions 156 | the name is followed by the localized form of the string "(Pre-Release)". 157 | */ 158 | - (NSString*)displayName; 159 | 160 | /*! 161 | @method downloadURLForCurrentArchitecture 162 | @abstract Returns the asset's download url for the current architecture. 163 | @discussion Returns a NSURL object or nil, if there's no install url for the current architecture. 164 | */ 165 | - (NSURL*)downloadURLForCurrentArchitecture; 166 | 167 | /*! 168 | @method dictionaryRepresentation 169 | @abstract Returns a dictionary representation of the MTSapMachineAsset object. 170 | */ 171 | - (NSDictionary*)dictionaryRepresentation; 172 | 173 | @end 174 | -------------------------------------------------------------------------------- /source/SapMachine Manager/View Controllers/MTInstallController.m: -------------------------------------------------------------------------------- 1 | /* 2 | MTInstallController.m 3 | Copyright 2023-2025 SAP SE 4 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); 6 | you may not use this file except in compliance with the License. 7 | You may obtain a copy of the License at 8 | 9 | http://www.apache.org/licenses/LICENSE-2.0 10 | 11 | Unless required by applicable law or agreed to in writing, software 12 | distributed under the License is distributed on an "AS IS" BASIS, 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | See the License for the specific language governing permissions and 15 | limitations under the License. 16 | */ 17 | 18 | #import "MTInstallController.h" 19 | #import "MTSapMachineUser.h" 20 | #import "Constants.h" 21 | 22 | @interface MTInstallController () 23 | @property (nonatomic, strong, readwrite) MTDaemonConnection *daemonConnection; 24 | @property (nonatomic, strong, readwrite) NSOperationQueue *operationQueue; 25 | @property (atomic, copy, readwrite) NSData *authData; 26 | @property (assign) BOOL installInProgress; 27 | @property (assign) BOOL installSuccess; 28 | 29 | @property (weak) IBOutlet NSProgressIndicator *progressIndicator; 30 | @property (weak) IBOutlet NSTextField *failAdditionalTextField; 31 | @end 32 | 33 | @implementation MTInstallController 34 | 35 | - (void)viewDidLoad 36 | { 37 | [super viewDidLoad]; 38 | 39 | self.installInProgress = YES; 40 | self.installSuccess = NO; 41 | 42 | _operationQueue = [[NSOperationQueue alloc] init]; 43 | _daemonConnection = [[MTDaemonConnection alloc] init]; 44 | 45 | NSBlockOperation *authOperation = [[NSBlockOperation alloc] init]; 46 | [authOperation addExecutionBlock:^{ 47 | 48 | self->_authData = nil; 49 | MTSapMachineUser *user = [[MTSapMachineUser alloc] initWithUserName:NSUserName()]; 50 | 51 | if (![user isPrivileged]) { 52 | 53 | dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); 54 | 55 | dispatch_async(dispatch_get_main_queue(), ^{ 56 | 57 | [self->_daemonConnection connectToXPCServiceWithRemoteObjectProxyReply:^(id remoteObjectProxy, NSError *error) { 58 | 59 | [remoteObjectProxy authenticateWithAuthorizationReply:^(NSData *authorization) { 60 | 61 | self->_authData = authorization; 62 | dispatch_semaphore_signal(semaphore); 63 | }]; 64 | }]; 65 | }); 66 | 67 | dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); 68 | } 69 | }]; 70 | 71 | NSBlockOperation *privilegedOperation = [[NSBlockOperation alloc] init]; 72 | [privilegedOperation addExecutionBlock:^{ 73 | 74 | dispatch_async(dispatch_get_main_queue(), ^{ 75 | 76 | [self->_daemonConnection connectToDaemonWithExportedObject:self 77 | andExecuteCommandBlock:^{ 78 | 79 | [[self->_daemonConnection remoteObjectProxy] downloadAssets:[NSArray arrayWithObject:self->_selectedAsset] 80 | install:YES 81 | authorization:self->_authData 82 | completionHandler:^(BOOL success, NSError *error) { 83 | self->_authData = nil; 84 | 85 | if (error) { 86 | 87 | os_log_with_type(OS_LOG_DEFAULT, OS_LOG_TYPE_FAULT, "SAPCorp: Failed to install asset: %{public}@", error); 88 | 89 | if ([error helpAnchor] && NSLocalizedString([error helpAnchor], nil)) { 90 | dispatch_async(dispatch_get_main_queue(), ^{ 91 | [self.failAdditionalTextField setStringValue:NSLocalizedString([error helpAnchor], nil)]; 92 | }); 93 | } 94 | } 95 | 96 | [[NSNotificationCenter defaultCenter] postNotificationName:kMTNotificationNameInstallFinished 97 | object:nil 98 | userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:!success] 99 | forKey:kMTNotificationKeyInstallError 100 | ] 101 | ]; 102 | 103 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 104 | self.installSuccess = success; 105 | self.installInProgress = NO; 106 | 107 | [self->_daemonConnection invalidate]; 108 | self->_daemonConnection = nil; 109 | }); 110 | }]; 111 | }]; 112 | }); 113 | }]; 114 | 115 | [privilegedOperation addDependency:authOperation]; 116 | [self->_operationQueue addOperations:[NSArray arrayWithObjects:authOperation, privilegedOperation, nil] 117 | waitUntilFinished:NO]; 118 | } 119 | 120 | #pragma mark MTSapMachineAssetUpdateDelegate 121 | 122 | - (void)updateStartedForAsset:(MTSapMachineAsset*)asset 123 | { 124 | return; 125 | } 126 | 127 | - (void)updateFinishedForAsset:(MTSapMachineAsset*)asset 128 | { 129 | return; 130 | } 131 | 132 | - (void)updateFailedForAsset:(MTSapMachineAsset*)asset withError:(NSError*)error 133 | { 134 | if (error) { 135 | 136 | dispatch_async(dispatch_get_main_queue(), ^{ 137 | 138 | if ([error helpAnchor] && NSLocalizedString([error helpAnchor], nil)) { 139 | [self.failAdditionalTextField setStringValue:NSLocalizedString([error helpAnchor], nil)]; 140 | } else { 141 | [self.failAdditionalTextField setStringValue:[error localizedDescription]]; 142 | } 143 | }); 144 | } 145 | } 146 | 147 | - (void)downloadProgressUpdatedForAsset:(MTSapMachineAsset*)asset 148 | { 149 | dispatch_async(dispatch_get_main_queue(), ^{ 150 | [self.progressIndicator setDoubleValue:[asset updateProgress]]; 151 | }); 152 | } 153 | 154 | @end 155 | --------------------------------------------------------------------------------