#!/bin/sh

echo "$1"

if [ "$1" != remove ]
then
  exit 0
fi

setup_hdfsadm_user() {
  if ! getent passwd hdfsadm >/dev/null; then
    echo "no account found: 'hdfsadm'."
  else
    userdel hdfsadm
    rm -rf /home/hdfsadm
    rm -rf /var/log/hadoop
  fi
}

setup_hdfsadm_user
