post_install() {
  if [ -z "`getent group nrpe`" ]; then
    groupadd -g 31 nrpe
  fi
  if [ -z "`getent passwd nrpe`" ]; then
    useradd -u 31 -g nrpe -c "Nagios NRPE" -d /dev/null -s /bin/false nrpe
  fi
  
  echo "nrpe    5666/tcp     # nagios nrpe service" >> /etc/services 
}

post_upgrade() {
  post_install $1
}

pre_remove() {
  userdel nrpe &> /dev/null
  groupdel nrpe &> /dev/null
}

op=$1
shift

$op $*
