postinst: fix error handling if actions fails and adjust code indention