diff --git a/build-info.plist b/build-info.plist
index 7cd5125..e67fcbf 100644
--- a/build-info.plist
+++ b/build-info.plist
@@ -17,6 +17,6 @@
suppress_bundle_relocation
version
- 2.1.3
+ 2.1.4
diff --git a/payload/Library/Scripts/install_or_defer.sh b/payload/Library/Scripts/install_or_defer.sh
index 087f0b1..7d0ed8b 100644
--- a/payload/Library/Scripts/install_or_defer.sh
+++ b/payload/Library/Scripts/install_or_defer.sh
@@ -13,8 +13,8 @@
# restarts automatically.
# Authors: Elliot Jordan and Mario Panighetti
# Created: 2017-03-09
-# Last Modified: 2019-04-11
-# Version: 2.1.3
+# Last Modified: 2019-05-14
+# Version: 2.1.4
#
###
@@ -261,8 +261,13 @@ exit_without_updating () {
echo "Running jamf recon..."
"$jamf" recon
- "/bin/echo" "Unloading $BUNDLE_ID LaunchDaemon. Script will end here."
- "/bin/launchctl" unload -w "/private/tmp/$BUNDLE_ID.plist"
+ clean_up
+
+ if [[ -e "/private/tmp/$BUNDLE_ID.plist" ]]; then
+ "/bin/echo" "Unloading $BUNDLE_ID LaunchDaemon..."
+ "/bin/launchctl" unload -w "/private/tmp/$BUNDLE_ID.plist"
+ fi
+ "/bin/echo" "Script will end here."
exit 0
}
diff --git a/scripts/preinstall b/scripts/preinstall
index 835a278..cbc0e54 100755
--- a/scripts/preinstall
+++ b/scripts/preinstall
@@ -1,11 +1,21 @@
#!/bin/bash
+PLIST="$3/Library/Preferences/com.elliotjordan.install_or_defer"
+HELPER_LD="$3/private/tmp/com.elliotjordan.install_or_defer_helper.plist"
+MAIN_LD="$3/Library/LaunchDaemons/com.elliotjordan.install_or_defer.plist"
+
# Copy all output to the system log for diagnostic purposes.
exec 1> >(logger -s -t "$(basename "$0")") 2>&1
-HELPER_LD="$3/private/tmp/com.elliotjordan.install_or_defer_helper.plist"
-MAIN_LD="$3/Library/LaunchDaemons/com.elliotjordan.install_or_defer.plist"
+# Kill jamfHelper process to close all current notifications.
+echo "Killing any active jamfHelper notifications..."
+killall jamfHelper 2>"/dev/null"
+
+# Clean up plist values.
+echo "Cleaning up all stored plist values..."
+defaults delete "$PLIST" 2>"/dev/null"
+# Unload LaunchDaemons.
if [[ -f "$HELPER_LD" ]]; then
echo "Unloading and removing $HELPER_LD..."
launchctl unload -w "$HELPER_LD"