-
-
Save rtrouton/f7237beeefab97d94dbb20f5fd96cf4e to your computer and use it in GitHub Desktop.
Postinstall script for SAP GUI 7.50 rev 5 installer for macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
INSTALLERS=$(/bin/ls "${0%/*}"/PlatinGUI*.jar) | |
INSTALL_PATH="/Applications/SAP Clients" | |
JAVA_HOME=$(/usr/libexec/java_home) | |
JAVA_BIN="$JAVA_HOME/bin/java" | |
JAVAOPENJFX=$(/usr/bin/find /Library/Java/JavaVirtualMachines -maxdepth 1 -iname "*javafx*" -type d | /usr/bin/head -1) | |
JAVAOPENJFX_INSTALLED="$JAVAOPENJFX/lib/javafx.properties" | |
ERROR=0 | |
IFS=$'\n' | |
function log { | |
echo "$1" | |
/usr/bin/logger "SAPGUI Installer: $1" | |
} | |
if [[ -d "$JAVA_HOME" && -x "$JAVA_BIN" ]]; then | |
if [[ -f "$JAVAOPENJFX_INSTALLED" ]] || [[ -f "$JAVA_HOME/jre/lib/javafx.properties" ]]; then | |
if [[ -n "$JAVAOPENJFX" ]]; then | |
JAVAJFX="$JAVAOPENJFX/lib" | |
fi | |
for INSTALL in ${INSTALLERS}; do | |
if [[ -n "$JAVAOPENJFX" ]]; then | |
log "Attempting to install $INSTALL ..." | |
"$JAVA_BIN" -jar "$INSTALL" -a "$JAVAJFX" --nogui --force --nodesktopicons --installdir "$INSTALL_PATH" >/dev/null 2>&1 | |
else | |
log "Attempting to install $INSTALL ..." | |
"$JAVA_BIN" -jar "$INSTALL" --nogui --force --nodesktopicons --installdir "$INSTALL_PATH" >/dev/null 2>&1 | |
fi | |
if [[ $? -ne 0 ]]; then | |
log "ERROR! Installation of $INSTALL failed" | |
ERROR=1 | |
break | |
else | |
log "Successfully installed $INSTALL" | |
fi | |
done | |
else | |
log "ERROR! Java JFX is not installed." | |
ERROR=1 | |
fi | |
else | |
log "ERROR! Java not found" | |
ERROR=1 | |
fi | |
exit $ERROR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment