Home > Mac administration, macOS, Packaging, Scripting > Packaging a SAP GUI installer application for macOS

Packaging a SAP GUI installer application for macOS

One of the recent changes for the macOS version of SAP GUI for Java is that both SapMachine Java 11 and OpenJFX 11 are now bundled with SAP GUI, so it is no longer required to have Java installed on your machine in order for SAP GUI to work. This change has also been extended to the SAP GUI installer, which is now available as a notarized installer application as of SAP GUI 7.70.

You can run this installer on a Mac which does not have Java already installed and it will install SAP GUI for Java with SapMachine Java 11 and OpenJFX 11 installations embedded inside the SAP GUI application.

Note: As of SAP GUI 7.70 rev 2, Rosetta 2 is required if installing on an Apple Silicon Mac so Rosetta needs to be installed and running before installing SAP GUI.

The installer application is available for download to customers via a link on the announcement blog post:

https://blogs.sap.com/2021/03/16/ann-sap-gui-for-java-7.70-available-for-download/

When you click the download link, you will see two choices:

  • DMG
  • JAR

Screen Shot 2021 07 26 at 9 52 31 AM

The DMG download will provide the notarized installer application and the JAR download will provide the Java .jar installer that SAP GUI has traditionally used on macOS. I’ve discussed how to package the .jar installer in previous posts, so this post is going to focus on the new installer application contained inside the DMG download.

Screen Shot 2021 07 26 at 9 52 32 AM

For more details, please see below the jump.

If you want to run the SAP GUI installer application without repackaging it as a macOS installer package, use the procedure below:

1. Download the disk image.

Screen Shot 2021 07 26 at 2 00 35 PM

2. Mount the disk image.

Screen Shot 2021 07 22 at 2 16 27 PM

3. Copy the SAP GUI for Java Installer application to a convenient location.

Screen Shot 2021 07 26 at 2 28 16 PM

If you have a templates.jar file, copy the templates.jar file to the same location. As long as both files are in the same directory, the SAP GUI for Java Installer application will detect and use the templates.jar file’s contents to help configure SAP GUI.

Screen Shot 2021 07 26 at 2 02 26 PM

4. Launch the SAP GUI for Java Installer application.

Screen Shot 2021 07 22 at 2 16 55 PM

5. Follow the prompts to install.

Screen Shot 2021 07 22 at 2 17 20 PM

Screen Shot 2021 07 22 at 2 17 32 PM

Screen Shot 2021 07 22 at 2 17 56 PM

To build an installer package for SAP GUI which uses the installer application, use the procedure shown below:

Building the SAP GUI installer

Pre-requisites:

  • Packages
  • SAP GUI for Java Installer application
  • templates.jar file (optional)

1. Set up a new Packages project and select Raw Package.

Screen Shot 2021 07 26 at 10 34 15 AM

2. In this case, I’m naming the project SAP GUI 7.70 rev2.

Screen Shot 2021 07 26 at 10 34 25 AM

3. Once the Packages project opens, click on the Project tab. You’ll want to make sure that the your information is correctly set here (if you don’t know what to put in, check the Help menu for the Packages User Guide. The information you need is in Chapter 4 – Configuring a project.)

Screen Shot 2021 07 26 at 10 35 18 AM

In this example, I’m not changing any of the options from what is set by default.

4. Next, click on the Settings tab. In the case of my project, I want to install with root privileges and not require a logout, restart or shutdown.

To accomplish this, I’m choosing the following options in the Settings section:

In the Tag section:

  • Identifier: set as appropriate (for my installer, I’m using com.sap.pkg.SAPGUI770rev2
  • Version: set as appropriate (for my installer, I’m usings 7.70.02 )

In the Post-installation Behavior section:

  • On Success: should be set to Do Nothing

In the Options section:

  • Require admin password for installation should be checked
  • Relocatable should be unchecked
  • Overwrite directory permissions should be unchecked
  • Follow symbolic links should be unchecked

Screen Shot 2021 07 26 at 10 35 58 AM

7. Select the Payload tab. Nothing here should be changed from the defaults.

Screen Shot 2021 07 26 at 10 36 06 AM

8. Select the Scripts tab.

Under the Additional Resources section, add the following files:

  • The latest SAP GUI for Java installer (this is the SAP GUI for Java Installer application file)

Screen Shot 2021 07 26 at 10 51 17 AM

Screen Shot 2021 07 26 at 10 51 26 AM

  • If you have a templates.jar file, also add that file.

Screen Shot 2021 07 26 at 10 51 46 AM

Screen Shot 2021 07 26 at 2 15 31 PM

The last part is telling the SAP GUI for Java installer to run. For this, you’ll need a postinstall script.

Here’s the postinstall script being used for this installer package:

#!/bin/bash
install_dir=$(/usr/bin/dirname $0)
sap_gui_installer="$install_dir/SAP GUI for Java Installer.app"
sap_gui_install_path="/Applications/SAP Clients"
ERROR=0
if [[ -x "$sap_gui_installer" ]]; then
echo "Attempting to install $sap_gui_install"
"$sap_gui_installer/Contents/MacOS/install" -G –installdir "${sap_gui_install_path}" -J "${install_dir}" –force
if [[ $? -ne 0 ]]; then
echo "ERROR! Installation of $sap_gui_installer failed"
ERROR=1
else
echo "Successfully installed $sap_gui_installer"
fi
else
echo "$sap_gui_installer not found or not executable."
ERROR=1
fi
exit $ERROR

view raw
gistfile1.txt
hosted with ❤ by GitHub

If not already selected, select the postinstall script and add it to the project.

Screen Shot 2021 07 26 at 10 52 18 AM

Screen Shot 2021 07 26 at 10 52 31 AM

9. Build the package. (If you don’t know to build, check the Help menu for the Packages User Guide. The information you need is in Chapter 3 – Creating a raw package project and Chapter 10 – Building a project.)

Screen Shot 2021 07 26 at 10 38 13 AM

Screen Shot 2021 07 26 at 10 38 20 AM

Testing the installer

Once the package has been built, test it by installing it on a test machine which has the following:

  • Does not have the SAP GUI client installed

The end result should be that the SAP GUI client installs into /Applications.

Screen Shot 2021 07 26 at 1 48 42 PM

If a templates.jar file was included with the installer, the SAP GUI configuration files specified by the templates.jar file should also be installed.

Screen Shot 2021 07 26 at 1 47 38 PM

  1. Jason Y
    July 26, 2021 at 9:47 pm

    Hello! How would I go about also including the SAPGUILandscape.xml file in the package so that it also gets copied to ~/Library/Preferences/SAP? Our company relies on the SAPGUILandscape.xml to show the logon pad upon launch

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: