#!/bin/bash
__check_desktop() {
  if [ `(dpkg-query -W -f='${Status}' ubuntu-desktop 2>/dev/null | grep -c "ok installed")` -eq 1 ]; then
    echo "Ubuntu Server is required, but it appears that you are running Ubuntu Desktop"
    exit 1
  fi
}

# Now just call the function:
__check_desktop