postinst is what you're looking for, you can run xterm from there, but popping up a dialog is much more user friendly. You can do that by writing a program to handle the dialog and executing it from the postinst script.