First of all, you should be familiar with linux/unix prompt. See the man page of "eject": at the linux prompt type "man eject" and then press enter.
Second: Use TProcess so you can enable the application to execute a bash command "eject" to open the tray and "eject -t" to close the tray. See lazarus documentation of TProcess.