#!/bin/bash

set -e
set -x

function finish {
	if [[ $OK == "true" ]]
	then
		osascript -e 'display notification "UrBackup was uninstalled successfully." with title "UrBackup"'
	else
		osascript -e 'display notification "Failed to uninstall UrBackup" with title "UrBackup"'
	fi
}

trap finish EXIT

if /bin/launchctl list "org.urbackup.client.backend" &> /dev/null; then
	/bin/launchctl stop "org.urbackup.client.backend" 
    /bin/launchctl unload "/Library/LaunchDaemons/org.urbackup.client.plist"
fi

killall urbackupclientgui || true

/Applications/UrBackup\ Client.app/Contents/MacOS/urbackupclientgui remove_login_item

pkgutil --forget org.urbackup.client.service
pkgutil --forget org.urbackup.client


#!/bin/bash

set -e
set -x

function finish {
	if [[ $OK == true ]]
	then
		osascript -e 'display notification "UrBackup was uninstalled successfully." with title "UrBackup"'
		killall urbackupclientgui || true
	else
		osascript -e 'display notification "Failed to uninstall UrBackup" with title "UrBackup"'
	fi
}

trap finish EXIT

if /bin/launchctl list "org.urbackup.client.backend" &> /dev/null; then
	/bin/launchctl stop "org.urbackup.client.backend" 
    /bin/launchctl unload "/Library/LaunchDaemons/org.urbackup.client.plist"
fi

/Applications/UrBackup\ Client.app/Contents/MacOS/urbackupclientgui remove_login_item

pkgutil --forget org.urbackup.client.service
pkgutil --forget org.urbackup.client


Correct typo in finish function, and move gui kill command to end of process
Correct typo in finish function, and move gui kill command to end of process
