Files
Alte_Skripte/aktuelle_Scripte/de.ing.uninstaller_Application_1.1.sh
2026-02-16 15:05:15 +01:00

48 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