194 lines
5.6 KiB
Bash
Executable File
194 lines
5.6 KiB
Bash
Executable File
#!/bin/bash
|
|
#########################################################################################
|
|
# Shellscript : DEP Application Status
|
|
# Autor : Andreas Vogel, NEXT Enterprise GmbH
|
|
#########################################################################################
|
|
loggedInUser=$(scutil <<< "show State:/Users/ConsoleUser" | awk '/Name :/ && ! /loginwindow/{print $3}')
|
|
if [[ -z ${loggedInUser} || ${loggedInUser} == "root" ]]; then
|
|
echo "$(/bin/date +%Y-%m-%d\ %H:%M:%S) Info: No user logged in."
|
|
exit 0
|
|
fi
|
|
uid=$(id -u "${loggedInUser}")
|
|
iconing="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertNoteIcon.icns"
|
|
|
|
|
|
askforbutton2() {
|
|
message=${1}
|
|
title="DEP Status"
|
|
#button1=${3}
|
|
button2="OK"
|
|
launchctl asuser "${uid}" /usr/bin/osascript <<-EndOfScript
|
|
button returned of ¬
|
|
(display dialog "${message}" ¬
|
|
buttons {"${button2}"} ¬
|
|
default button "${button2}" with icon POSIX file "${iconing}" with title "${title}")
|
|
EndOfScript
|
|
}
|
|
|
|
|
|
# Prüfen, ob alle Apps installiert sind und das Gerät ausgegeben werden kann.
|
|
|
|
# 1. Computername
|
|
# 2. MS Apps installiert
|
|
# 3. Firefox
|
|
# 4. McAfee
|
|
# 5. Cisco AnyConnect
|
|
# 6. Cisco Jabber
|
|
# 7. Matrix42
|
|
# 8. C&A Fonts ????
|
|
# 9. HP Printer
|
|
# 10. Zscaler
|
|
|
|
|
|
##################################### Check #####################################
|
|
Applikationinfo() {
|
|
# 1. ComputerName
|
|
#ComputerName="BEM0006"
|
|
|
|
ComputerName=$(scutil --get ComputerName)
|
|
ComputerName_Rule=^[A-Z]{3}[0-9]{4}$
|
|
if [[ $ComputerName =~ $ComputerName_Rule ]]
|
|
then
|
|
ComputerName_Status=$(printf '\xE2\x9C\x85 Computer Name is set')
|
|
else
|
|
ComputerName_Status=$(printf '\xE2\x9D\x8C Computer Name is wrong')
|
|
ComputerName_Missing+=("$ComputerName_Status")
|
|
fi
|
|
|
|
# 2. MS Apps installiert
|
|
if [[ -d "/Applications/Microsoft Outlook.app" ]] && [[ -d "/Applications/Microsoft Word.app" ]]
|
|
then
|
|
MS_App_Status=$(printf '\xE2\x9C\x85 MS Apps OK')
|
|
else
|
|
MS_App_Status=$(printf '\xE2\x9D\x8C MS Apps Missing!')
|
|
MissingSoftware+=("$MS_App_Status")
|
|
fi
|
|
|
|
# 3. Firefox
|
|
if [[ -d "/Applications/Firefox.app" ]]
|
|
then
|
|
Firefox_App_Status=$(printf '\xE2\x9C\x85 Firefox OK')
|
|
else
|
|
Firefox_App_Status=$(printf '\xE2\x9D\x8C Firefox Missing!')
|
|
MissingSoftware+=("$Firefox_App_Status")
|
|
fi
|
|
|
|
# 4. McAfee | inc. Status?
|
|
# Status launchctl list | grep com.mcafee.menulet
|
|
if [[ -d "/Applications/McAfee Endpoint Security for Mac.app" ]]
|
|
then
|
|
McAfee_Status=$(printf '\xE2\x9C\x85 McAfee OK')
|
|
else
|
|
McAfee_Status=$(printf '\xE2\x9D\x8C McAfee Missing!')
|
|
MissingSoftware+=("$McAfee_Status")
|
|
fi
|
|
|
|
# 5. Cisco AnyConnect
|
|
if [[ -d "/Applications/Cisco/Cisco AnyConnect Secure Mobility Client.app" ]]
|
|
then
|
|
Cisco_AnyConnect_Status=$(printf '\xE2\x9C\x85 Cisco AnyConnect OK')
|
|
else
|
|
Cisco_AnyConnect_Status=$(printf '\xE2\x9D\x8C Cisco AnyConnect Missing!')
|
|
MissingSoftware+=("$Cisco_AnyConnect_Status")
|
|
fi
|
|
|
|
# 6. Cisco Jabber
|
|
if [[ -d "/Applications/Cisco Jabber.app" ]]
|
|
then
|
|
Cisco_Jabber_Status=$(printf '\xE2\x9C\x85 Cisco Jabber OK')
|
|
else
|
|
Cisco_Jabber_Status=$(printf '\xE2\x9D\x8C Cisco Jabber Missing!')
|
|
MissingSoftware+=("$Cisco_Jabber_Status")
|
|
fi
|
|
|
|
# 7. Matrix42 ??????????
|
|
if [[ -d "/Library/Application Support/matrix42/Inventory/MX42HelperTool.app" ]]
|
|
then
|
|
Matrix42_Status=$(printf '\xE2\x9C\x85 Matrix42 OK')
|
|
else
|
|
Matrix42_Status=$(printf '\xE2\x9D\x8C Matrix42 Missing!')
|
|
MissingSoftware+=("$Matrix42_Status")
|
|
fi
|
|
|
|
# 8. C&A Fonts
|
|
if [[ -f "/Library/Fonts/CA InfoTypeCY-BoldCon.ttf" ]] && [[ -f "/Library/Fonts/CA InfoTypeOPTU-RegularCon.otf" ]]
|
|
then
|
|
CundA_Fonts_Status=$(printf '\xE2\x9C\x85 C&A Fonts OK')
|
|
else
|
|
CundA_Fonts_Status=$(printf '\xE2\x9D\x8C C&A Fonts Missing!')
|
|
MissingSoftware+=("$CundA_Fonts_Status")
|
|
fi
|
|
|
|
|
|
# 9. HP Printer???
|
|
|
|
|
|
# 10. Zscaler
|
|
# Status launchctl list | grep zscaler
|
|
if [[ -d "/Applications/Zscaler/Zscaler.app" ]]
|
|
then
|
|
Zscaler_Status=$(printf '\xE2\x9C\x85 Zscaler OK')
|
|
else
|
|
Zscaler_Status=$(printf '\xE2\x9D\x8C Zscaler Missing!')
|
|
MissingSoftware+=("$Zscaler_Status")
|
|
fi
|
|
|
|
|
|
if [[ -z "${MissingSoftware[@]}" ]]
|
|
then
|
|
Software_Missing_Message="Great, all the necessary software has been installed"
|
|
else
|
|
Software_Missing_Message="Missing software, can be loaded in SelfService"
|
|
fi
|
|
|
|
if [[ -z "${ComputerName_Missing[@]}" ]]
|
|
then
|
|
Computername_Missing_Message=""
|
|
else
|
|
Computername_Missing_Message=$(printf '\xE2\x9D\x8C Attention! Device name is not set correctly. This will not distribute a certificate for VPN and Wlan. Please set the device name correctly.')
|
|
fi
|
|
}
|
|
|
|
|
|
|
|
##################################### Print Info to User ########################
|
|
|
|
while [[ ${exit} != "OK" ]]; do
|
|
Applikationinfo
|
|
if [[ $(sw_vers -buildVersion) > "19" ]]; then
|
|
exit=$(askforbutton2 "\
|
|
\n-----------------------------------------------\
|
|
\nStatus:\t${ComputerName_Status}\
|
|
\nStatus:\t${MS_App_Status}\
|
|
\nStatus:\t${Firefox_App_Status}\
|
|
\nStatus:\t${McAfee_Status}\
|
|
\nStatus:\t${Cisco_AnyConnect_Status}\
|
|
\nStatus:\t${Cisco_Jabber_Status}\
|
|
\nStatus:\t${Matrix42_Status}\
|
|
\nStatus:\t${CundA_Fonts_Status}\
|
|
\nStatus:\t${Zscaler_Status}\
|
|
\n-----------------------------------------------\
|
|
\n${Computername_Missing_Message}\
|
|
\n\
|
|
\n${Software_Missing_Message}")
|
|
|
|
else
|
|
exit=$(askforbutton2 "\
|
|
\n-----------------------------------------------\
|
|
\n\t${ComputerName_Status}\
|
|
\nStatus:\t${MS_App_Status}\
|
|
\nStatus:\t${Firefox_App_Status}\
|
|
\nStatus:\t${McAfee_Status}\
|
|
\nStatus:\t${Cisco_AnyConnect_Status}\
|
|
\nStatus:\t${Cisco_Jabber_Status}\
|
|
\nStatus:\t${Matrix42_Status}\
|
|
\nStatus:\t${CundA_Fonts_Status}\
|
|
\nStatus:\t${Zscaler_Status}\
|
|
\n-----------------------------------------------\
|
|
\nMissing software, can be loaded in SelfService")
|
|
fi
|
|
done
|
|
|
|
################################### end ########################################
|
|
exit 0
|