post_install() {
  if [ -z "`getent group amanda`" ]; then
	groupadd -g 112 amanda
  fi
  if [ -z "`getent passwd amanda`" ]; then
	useradd -u 112 -g amanda -G storage,disk -m -d /var/amanda -s /bin/bash -c "Amanda Backup Daemon"  amanda
  fi
  cat << EOT
amanda: Visit the Amanda wiki to configure your backup sets:"
amanda:   http://wiki.zmanda.com/index.php/Quick_start#Configuring_the_backup_server"
amanda: Examples are in /etc/amanda/examples/

amanda: The daemon is run by xinetd so restart xinetd to start the daemon listening for connections.
EOT
}

post_upgrade() {
  post_install $1
}

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

op=$1
shift

$op $*
