#!/bin/bash

function remove_opt_banyan {
  rm -rf /opt/banyan
}

# Remove /opt/banyan dir when this script exits
trap remove_opt_banyan EXIT

if [[ $(ps -p1 | grep -o "systemd") == "systemd" ]]; then
  systemctl stop netagent
  systemctl disable netagent
  rm -f /lib/systemd/system/netagent.service
  systemctl daemon-reload
else
  initctl stop netagent
  rm -f /etc/init/netagent.conf
fi
