Skip to content

Instantly share code, notes, and snippets.

@HiDood
Created September 13, 2017 01:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HiDood/80611f374a081dbaca0c713bea259cb9 to your computer and use it in GitHub Desktop.
Save HiDood/80611f374a081dbaca0c713bea259cb9 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Uninstaller script for Aventail OnDemand Daemon.
# This script removes all files associated with the Aventail OnDemand Daemon.
# Please copy this file to your home directory before executing it.
echo ""
echo "***Aventail OnDemand Daemon Uninstaller***"
echo ""
echo "You need to have Administrator privileges on this computer to"
echo "complete the operation."
#echo ""
#echo -n "Do you wish to proceed with the uninstallation [y/n]: "
#read RESPONSE
#if [ "$RESPONSE" != "y" ]; then
# exit 0
#fi
OSX_V4_STARTUP_DIR="/Library/StartupItems/OnDemand"
OSX_V3_STARTUP_DIR="/System/Library/StartupItems/OnDemand"
OD_EXEC_DIR="/var/Aventail/ondemand"
OD_HOME_DIR="$HOME/Library/Application Support/Aventail/ondemand"
INSTALL_FOUND="false"
# If the daemon is already running then stop it
DAEMON_PID=`ps -axww | grep -v grep | grep "ODService" | awk '{print $1}'`
if [ $DAEMON_PID ]; then
INSTALL_FOUND="true"
sudo kill $DAEMON_PID
fi
# Remove files from the /Library/StartupItems folder if on Mac OS X v4
if [ -d $OSX_V4_STARTUP_DIR ]; then
INSTALL_FOUND="true"
sudo rm -rf $OSX_V4_STARTUP_DIR
fi
# Remove files from the System/Library/StartupItems folder if on Mac OS X v3
if [ -d $OSX_V3_STARTUP_DIR ]; then
INSTALL_FOUND="true"
sudo rm -rf $OSX_V3_STARTUP_DIR
fi
# Remove files from the Aventail OnDemand Daemon execution directory
if [ -d $OD_EXEC_DIR ]; then
INSTALL_FOUND="true"
sudo rm -rf $OD_EXEC_DIR
fi
# Remove files from the Aventail OnDemand Daemon home directory
if [ -d "$OD_HOME_DIR" ]; then
INSTALL_FOUND="true"
sudo rm -rf "$OD_HOME_DIR"
fi
if [ "$INSTALL_FOUND" == "true" ]; then
# Expire sudo timestamp
sudo -k
else
echo ""
echo "No installation of Aventail OnDemand Daemon was found on your computer."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment