#!/usr/bin/env bash

PATH=.:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:`dirname $0`

user=`whoami`
sudo='sudo'
if [ $user = 'root' ]; then
  sudo=''
fi

pkgpanda=/opt/mesosphere/bin/pkgpanda
if [ -e "$pkgpanda" ]; then
  echo 'Uninstalling DC/OS packages...'
  $sudo -i $pkgpanda uninstall
fi

if [ -e /opt/mesosphere ]; then
  echo 'Remove /opt/mesosphere and /etc/mesosphere ...'
  $sudo rm -rf /opt/mesosphere /etc/mesosphere
fi
