There is also the whiptail
command, if you only want to write a shell script (as the debian installer is).
There is a good page of it in the Bash Shell Scripting Book on WikiBooks:
https://en.wikibooks.org/wiki/Bash_Shell_Scripting/Whiptail
solved How to create simple command line UI like the debian installer? [duplicate]