52 lines
2.0 KiB
Bash
52 lines
2.0 KiB
Bash
#!/bin/bash
|
|
|
|
##########################################################################
|
|
# Shellscript :
|
|
# Author : Andreas Vogel / macenterprise gmbh
|
|
##########################################################################
|
|
|
|
jamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
|
|
jamf="/usr/local/bin/jamf"
|
|
|
|
FileVaultIcon="/Library/Application Support/JAMF/ING/SmallFileVaultIcon.png"
|
|
ErrorIcon="/Library/Application Support/JAMF/ING/France_road_sign_A14.svg.png"
|
|
SuccessfulIcon="/Library/Application Support/JAMF/ING/ok-1976099_640.png"
|
|
|
|
a1=$(find /Library/Java/JavaVirtualMachines -type d -name '*.jdk' -prune -print)
|
|
|
|
title='Auf deinem System befinden sich die folgenden JAVA Versionen:'
|
|
|
|
HELPER=$("$jamfHelper" -windowType utility -icon "$FileVaultIcon" -title "$title" -description "$a1" -button1 "OK" -button2 "Cancel" -cancelButton "2" -defaultButton 2)
|
|
echo "Jamf Helper Exit Code: $HELPER"
|
|
|
|
if [ "$HELPER" == "0" ]
|
|
then
|
|
osascript <<EOF
|
|
|
|
set theJavaChoices to {"java_151", "java_191", "java_201", "java_211"}
|
|
set theJavaDel to choose from list theJavaChoices with prompt "Wähle das JAVA aus, dass entfernt werden soll" default items {"java_151"}
|
|
|
|
|
|
if theJavaDel = {"java_151"} then
|
|
do shell script "sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk"
|
|
display dialog "Das Java wurde gelöscht." buttons {"OK"} default button 1
|
|
|
|
else if theJavaDel = {"java_191"} then
|
|
do shell script "sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk"
|
|
display dialog "Das Java wurde gelöscht." buttons {"OK"} default button 1
|
|
|
|
else if theJavaDel = {"java_201"} then
|
|
do shell script "sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk"
|
|
display dialog "Das Java wurde gelöscht." buttons {"OK"} default button 1
|
|
|
|
else if theJavaDel = {"java_211"} then
|
|
do shell script "sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_211.jdk"
|
|
display dialog "Das Java wurde gelöscht." buttons {"OK"} default button 1
|
|
|
|
end if
|
|
EOF
|
|
|
|
else
|
|
|
|
exit 0
|
|
fi |