fix dirname evaluation in install script

The directory name evaluation has an issue if the script is called from the same directory, then PROGRAM_DIR is set to $0.