50 lines
1.3 KiB
Bash
50 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
|
|
##########################################################################
|
|
# Shellscript : Uninstall Script
|
|
# Autor : Andreas Vogel, macenterprise gmbh, 11.06.2019
|
|
##########################################################################
|
|
|
|
# Script fragt nach der Datei, die gelöscht werden soll.
|
|
|
|
# Nur für Test - in Produktion auskommentieren!
|
|
# set -x
|
|
|
|
###### bitte nur hier editieren
|
|
###### zu schützende Dateien hier untereinander aufführen
|
|
|
|
app_protect="
|
|
NoMAD
|
|
McAfee
|
|
ING Germany Self Service
|
|
Preproxy
|
|
Identity Agent"
|
|
|
|
##### Ende
|
|
|
|
# Variabeln
|
|
sys=$(while read p; do echo "$p" | grep "/Applications" ; done </System/Library/Sandbox/rootless.conf)
|
|
|
|
list="
|
|
$app_protect
|
|
$sys"
|
|
|
|
app=$(osascript << EOF
|
|
set theDocument to choose file with prompt "Wähle die App aus, die gelöscht werden soll"
|
|
set theDocument to POSIX path of theDocument
|
|
EOF)
|
|
|
|
# Schleife zur Überprüfung vor dem Löschen
|
|
for a in $list ; do
|
|
if [[ "$app" = *$a* ]]; then
|
|
osascript -e 'display dialog "Dieses Programm kann nicht gelöscht werden !" buttons {"OK"} default button 1'
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
# Programm wird gestoppt und gelöscht
|
|
pkill -f "$app"
|
|
rm -rf "$app"
|
|
osascript -e 'display dialog "Das Programm wurde gelöscht !" buttons {"OK"} default button 1'
|
|
exit 0 |