Add check for return code for pre and post install hooks.

Testing Done:

Tested on x86_64 platforms.