#!/bin/bash
## uninstall script for SonicWALL SSL-VPN Linux client

VERSION="8.5.0.50"

USRLIB='/usr/lib'
LIB='/lib'

## FUNCTIONS ###########################################################
function check_64bit
{
	# Are we on 64-bit architecture?
	if [[ "`uname -m`" =~ '64' ]]
	then
		# Is /usr/lib64 a directory?
		if [ -d /usr/lib64 -a ! -L /usr/lib64 ]
		then
			USRLIB='/usr/lib64'
		fi

		# Is /lib64 a directory?
		if [ -d /lib64 -a ! -L /lib64 ]
		then
			LIB='/lib64'
		fi
	fi
}
function assert_running_as_root
{
	if [ "`id -u`" != "0" ]
	then
		echo "Please run the VirtualAssist uninstaller as root."
		echo "On many systems, you can use the sudo command:"
		echo
		echo "  sudo ./uninstall"
		echo
		exit 1
	fi
}

assert_running_as_root
check_64bit

rm -f /usr/bin/VirtualAssistGui
rm -f /usr/share/man/man2/VirtualAssist.2
rm -f $USRLIB/libVirtualAssist.so
rm -f /usr/lib/VirtualAssist.jar
rm -f /usr/bin/vasac
rm -rf /usr/share/VirtualAssist
rm -f /usr/share/applications/sonicwall-virtualassist.desktop

echo "VirtualAssist has been uninstalled."