Hey peeps,
I'm totally new at scripting. My goal is to start by creating a script to uninstall a particular app. Eventually, I want to add it to the Self Service app.
Would someone mind pointing in the right direction?
Thanks!
Hey peeps,
I'm totally new at scripting. My goal is to start by creating a script to uninstall a particular app. Eventually, I want to add it to the Self Service app.
Would someone mind pointing in the right direction?
Thanks!
@user-wjoxMmfeJA The following may prove helpful:
#!/bin/sh
####################################################################################################
#
# ABOUT
#
# Removes application passed as Parameter 5. (Used prior to installing updated application.)
#
# See: https://github.com/talkingmoose/Jamf-Management-Templates/wiki/Baseline-Mozilla-Firefox
#
####################################################################################################
#
# HISTORY
#
# Version 1.0, 26-Oct-2017, Dan K. Snelson
#
####################################################################################################
# Variables
authorizationKey="$4"
applicationPath="$5"
# Check for a specified value in Parameter 4
if [ "$authorizationKey" != "obscure, hard-to-guess string goes here" ]; then
echo "Error: Incorrect Authorization Key; exiting."
exit 1
fi
# If Parameter 5 is blank, exit ...
if [ -z "${applicationPath}" ]; then
echo "Application Path not specified; exiting."
exit 1
fi
# Check if the specified application is installed ...
testDirectory="/Applications/${applicationPath}"
if [ -d "${testDirectory}" ] ; then
echo "/Applications/${applicationPath} located; proceeding ..."
echo "Removing /Applications/${applicationPath} ..."
rm -Rf "/Applications/${applicationPath}"
echo "Removed /Applications/${applicationPath}."
else
echo "/Applications/${applicationPath} NOT found; nothing to remove."
fi
exit 0
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.